Thread: Loop problems
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
blackbox via OfficeKB.com blackbox via OfficeKB.com is offline
external usenet poster
 
Posts: 59
Default Loop problems

this locks up Excel

Is it because I'm running a loop within an If, Then, Else?

Sub Timer()
Application.Wait Now + TimeValue("00:00:01")
Run_Time_and_Sales2
End Sub

Sub Run_Time_and_Sales2()

Dim LastPrint As Integer
Dim PrintTime As Double
Dim I As Integer

I = 1

LastPrint = Range("A" & I).Value
PrintTime = Range("B" & I).Value


If Range("F1") = "x" Then
Do
Loop While I < 26
Range("D4") = LastPrint
Range("E4") = PrintTime
I = I + 1
Else: End
End If

Timer

End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200706/1