which function in VBA can tell me that a cell has a #DIV/0 error so I could change its value to ""?
(Say something like "if (cells(1,1).XXX) then cells.value=""
I guess it's elementary but I'm on this one for the whole afternoon ...
If [C1].Text = "#DIV/0!" Then [C1] = "0"
[/color]
But of course that destroys whatever formula you had in the cell ("C1" in this example) by replacing it with a constant zero. That may be ok if your macro code is putting the formula there in the first place.
However, you would be better off not using VBA, but rather using a formula like this: [blue]
Code:
=IF(B1,A1/B1,0)
[/color]
so that when "B1" is zero the result is zero otherwise the result is the quotient.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.