Thread: Loop problems
View Single Post
  #3   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

That worked. Got it to run through with the time delay as well.
Thanks!

One more question, do you know how I can interrupt the loop from a command
button?
I was thinking maybe an event Change with a command button linked to a cell
and either a Case statement or an If, Then Else but haven't been able to make
it work.

Sub Run_Time_and_Sales()

Dim LastPrint As Integer
Dim PrintTime As Double

I = 1

If Range("F1") = "x" Then

Do

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

Range("D4") = LastPrint
Range("E4") = PrintTime
I = I + 1
Application.Wait Now + TimeValue("00:00:01")
Loop Until I 24

Else: End
End If

End Sub

--
Message posted via http://www.officekb.com