View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
VTengineer VTengineer is offline
external usenet poster
 
Posts: 2
Default Logical comparison not working in VBA ????

Thanks.
Seems obvious now.....


"Rick Rothstein (MVP - VB)" wrote:

Maybe the problem is that you are comparing real numbers for equality
- always dangerous due to possible round off error. Maybe replace

If StopLong = 0.085 Then

by

If Abs(StopLong - 0.085) < 0.00001 Then

and see what happens.


Just to add to your response... this is a very old problem and the solution
you offered has been the preferred method around it. Here is a link that
goes into more detail... the code may look odd, but if you scroll down to
the bottom of the page and see the programming languages it applies to, I
think you will understand why. As I said, this is a very old problem.<g

Rick