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





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Countdown Timer 6
Visible countdown timer 5
Stop my timer 4
executions per second 2
Timer 2
Timer w/ Start, Stop, Pause 2
making a countdown timer 1
Stopping a timer 10

Back
Top