View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_2313_] Rick Rothstein \(MVP - VB\)[_2313_] is offline
external usenet poster
 
Posts: 1
Default Logical comparison not working in VBA ????

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