View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default can anyone help me for "#DIV/0!" Error

Hi,

I don't understand the problem. The line
if(A<0) then
ensures you won't get a #DIV/0 error but you could get a type mismatch. I
suggest you change that line to

If a < 0 And IsNumeric(a) Then


Mike


"Arvind Mane" wrote:

i am doing some caculations in excel cells, my result is in cell A1,
if the result comes "#DIV/0!" then While executing the following macro, VBA
gives me Debug message. The value of A becomes "Error 2007".
How can i solve this problem?


Sub Postmacro()
A = Cells(1, 1).Value
B = 1.5
if(A<0) then
C = B / A
End if
End Sub