View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
alecbowman[_2_] alecbowman[_2_] is offline
external usenet poster
 
Posts: 10
Default Problem with Do While loop

I am using a Do While loop to find when a time has been reached in a list of
measurements e.g.

Dim Time_Now As Double
Dim Calc_End_Time As Double

Calc_End_Time = Time_Now + Slew_Settle_Time

Do While Time_Now < Calc_End_Time
Time_Now = Sheets("Synchro.LFSS_Training_Tellback").Cells(p, 2)
p = p + 1
Loop
p = p - 1

This seems to work rather unreliably in that the condition should be met
when the two times are equal or Time_Now is later than Calc_End_Time.

Sometimes Time_Now < Calc_End_Time is shown as False when the times are the
same, (Calc_End_Time = 36552.0671068634 and Time_Now = 36552.0671068634).

This same code works correctly for other data and is consistently wrong in
other areas.

Any help would be gratefully received.

Alec