Does anyone know how to make a timer / countdown function that runs for 2 minutes and then switches from one sheet to another?
So:
Run timer
If time = 120 sec
Then go to sheet "start"
Thank you
Does anyone know how to make a timer / countdown function that runs for 2 minutes and then switches from one sheet to another?
So:
Run timer
If time = 120 sec
Then go to sheet "start"
Thank you
You'd use Application.Ontime
Something like below...
See link for more detailed tutorial on Application.OnTime.![]()
Please Login or Register to view this content.
http://www.snb-vba.eu/VBA_Application.OnTime_en.html
Hi Andre,
I don't know how you want to trigger the code, but running start_timer will wait 2 minutes, then worksheet "Start" will activate.
![]()
Please Login or Register to view this content.
Please help by:
Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know
There are 10 kinds of people in this world... those who understand binary, and those who don't.
Sir askadi how to do use doevents not application on time.. I ever see use doevents how to fix this code
[/QUOTE]![]()
Please Login or Register to view this content.
Last edited by daboho; 01-30-2017 at 05:20 PM.
DoEvents just allows the code to delay to run other things (I don't find it helps a lot most of the time), however, the method you are looking for should be something like this... round, 2 gives seconds which is why I've made it stop at 120. I put >= in case it is 121 seconds for some reason... if we stop only if =120 then if we miss 120 exactly it will never stop:
![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks