Home #DIV/0! error and replace it with zero
Reply: 0

#DIV/0! error and replace it with zero

user5197 Published in September 20, 2018, 4:35 pm

I am trying the below code to detect DIV/0 error and replace it with Zero or empty cell. but ** line is throwing me error

Dim Cell As Range
Dim iSheet as Worksheet
For Each iSheet In sheets(Array("Sheet1", "Sheet2", "Sheet3"))
    With iSheet
        For Each Cell In .UsedRange
            **If Cell.Value = CVErr(xlErrDiv0) Then Cell.Value = 0**
        Next Cell
    End With
Next iSheet
share|improve this question
  • See cpearson.com/excel/ReturningErrors.aspx (as per @DisplayName's answer). – SJR Feb 14 at 18:00

1 Answer 1

active oldest votes
up vote 2 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.363842 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO