number of seconds timer

  • Thread starter Thread starter sdg8481
  • Start date Start date
S

sdg8481

hi,

I want to be able to count from 1 to 120 seconds in a cell when i start the
macro, and then stop when i get to 120 - what is the best way of doing this.

Hope you can help.

Thaanks
 
This pauses the macro for 120 seconds while other events are allowed to
occur.

t = Timer + 120
Do While Timer < t
DoEvents
Loop
 
Hi,

Thank you for this, but unfortunatley its not quite what i was
after.....sorry my original post was a little rushed.

Basically, i need a number in cell A1 to count to 120 (1 per second) and
then stop once it hits 120.

Hope this makes a little more sense.

Thank You
 
Hi
Would this do ?
Sub count()
Dim i As Integer
Dim x As Integer
x = 120
Range("A1").Value = 0
For i = 1 To x
mycount = Range("a1") + 1
Application.Wait (Now + TimeValue("0:00:01"))
Range("a1") = mycount
Next i

End Sub
 
Works perfectly, brilliant Thank You

John said:
Hi
Would this do ?
Sub count()
Dim i As Integer
Dim x As Integer
x = 120
Range("A1").Value = 0
For i = 1 To x
mycount = Range("a1") + 1
Application.Wait (Now + TimeValue("0:00:01"))
Range("a1") = mycount
Next i

End Sub
------------------
This will count 2 minutes in cell A1, just change A1 to your choice.

HTH
John





.
 
Back
Top