ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   number of seconds timer (https://www.excelbanter.com/excel-programming/441807-number-seconds-timer.html)

sdg8481

number of seconds timer
 
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

JLGWhiz[_2_]

number of seconds timer
 
This pauses the macro for 120 seconds while other events are allowed to
occur.

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


"sdg8481" wrote in message
...
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




sdg8481

number of seconds timer
 
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

"JLGWhiz" wrote:

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

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


"sdg8481" wrote in message
...
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



.


John[_22_]

number of seconds timer
 
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



"sdg8481" wrote in message
...
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



sdg8481

number of seconds timer
 
Works perfectly, brilliant Thank You

"John" wrote:

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



"sdg8481" wrote in message
...
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


.


John[_22_]

number of seconds timer
 
You're welcome
Thanks for feeding back.
Regards
John
"sdg8481" wrote in message
...
Works perfectly, brilliant Thank You

"John" wrote:

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



"sdg8481" wrote in message
...
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


.




All times are GMT +1. The time now is 11:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com