![]() |
Using a timer
I need to create a timer that counts off seconds on my form. For example, I need to click on button 1 and testbox 1 starts counting off 1, 2, 3, etc.... and the timer stops when i click button 2, leaving the final time count in testbox 1. How can I do this? -- Tha BeatMaker ------------------------------------------------------------------------ Tha BeatMaker's Profile: http://www.excelforum.com/member.php...o&userid=23998 View this thread: http://www.excelforum.com/showthread...hreadid=392692 |
Using a timer
Hi Beatmaker,
I don't know if you need help with the triggering itself, but take a look at this timer code. This example puts the timer in the status bar rather than on a form. If you want to be able to do something else while it runs, you can uncomment the DoEvents. Sub timer_example() timeout_limit = 10 start_time = Time() Do While time_difference < timeout_limit Application.StatusBar = time_difference & " seconds elapsed out of " & timeout_limit 'DoEvents current_time = Time() time_difference = DateDiff("s", start_time, current_time) Loop End Sub |
Using a timer
Beatmaker,
I gave an example back in May. Find it here http://tinyurl.com/crtl3 -- HTH RP (remove nothere from the email address if mailing direct) "KCarhart" wrote in message ps.com... Hi Beatmaker, I don't know if you need help with the triggering itself, but take a look at this timer code. This example puts the timer in the status bar rather than on a form. If you want to be able to do something else while it runs, you can uncomment the DoEvents. Sub timer_example() timeout_limit = 10 start_time = Time() Do While time_difference < timeout_limit Application.StatusBar = time_difference & " seconds elapsed out of " & timeout_limit 'DoEvents current_time = Time() time_difference = DateDiff("s", start_time, current_time) Loop End Sub |
Using a timer
There's a timer control here too:
http://www.enhanceddatasystems.com/E...ExcelTimer.htm Robin Hammond www.enhanceddatasystems.com -- Robin Hammond www.enhanceddatasystems.com "Bob Phillips" wrote in message ... Beatmaker, I gave an example back in May. Find it here http://tinyurl.com/crtl3 -- HTH RP (remove nothere from the email address if mailing direct) "KCarhart" wrote in message ps.com... Hi Beatmaker, I don't know if you need help with the triggering itself, but take a look at this timer code. This example puts the timer in the status bar rather than on a form. If you want to be able to do something else while it runs, you can uncomment the DoEvents. Sub timer_example() timeout_limit = 10 start_time = Time() Do While time_difference < timeout_limit Application.StatusBar = time_difference & " seconds elapsed out of " & timeout_limit 'DoEvents current_time = Time() time_difference = DateDiff("s", start_time, current_time) Loop End Sub |
All times are GMT +1. The time now is 05:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com