Divide by Zero

  • Thread starter Thread starter Steve
  • Start date Start date
Steve said:
How Can I get rid of/avoid Divide by 0 Errors?

Somestimes it's unavoidable.

If Bottom = 0 or IsNull(Bottom) then

msgbox "you can't divide by zero"
else
ans = top/bottom.

end if.

This is a crude solution

While I can think of a few cases where it might cause a problem, usually it
can be avoided with proper design.
 
If you know that the divisor in a calculation may, under some
circumstances, be zero, you must explicitly test for that possibility
befoe you perform the calculation.

How Can I get rid of/avoid Divide by 0 Errors?

Somestimes it's unavoidable.

Thanks
Steve


Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
Back
Top