Is there anyway in which I can run macro at regular intervals.
For example, Macro1 to be run every 180 minutes.
Thanks in advance
Is there anyway in which I can run macro at regular intervals.
For example, Macro1 to be run every 180 minutes.
Thanks in advance
Hi
Have a look at the application.ontime method.
There are plenty of examples on the forum, as well as the excel vba help file.
rylo
Thanks for the infoPlease Login or Register to view this content.
Ok... I use the above code for running Macro2 every 1 hour. But I am having a problem here.. the Macro2 itself takes 3 - 5 mins (varies at different times) to run. Due to this the Macro2 doesnt run exactly at 1 hour. It runs at 63 - 65 minutes due to the time taken by macro2.
Is there anyway in which I can get it run exactly 1 hour which includes the macro running time also.
Any help regarding this would be much appreciated.
Plz let me know if you require any more info
You could call the starttimer at the start of macro2
Please Read Forum Rules Before Posting
Wrap VBA code by selecting the code and clicking the # icon or Read This
How To Cross Post politely
Top Excel links for beginners to Experts
If you are pleased with a member's answer then use the Scales icon to rate it
If my reply has assisted or failed to assist you I welcome your Feedback.
The problem if I put the starttimer at the beginning is:
The starttimer will run exactly in 1 hour after the function is called thus running the Macro2. After this, immediately the Macro2 will repeat once again. (coz the code lies below it)
But I want this to run only once every 1 hour
MAcro2 starts to run
It calls the Starttimer macro which sets the time that macro2 is to run (i hour in the future)
After starttimer has run macro2 continues to run
Do not call starttimer again from macro2
Macro2 will only run once per hour & exactly 1 hour from when macro2 was last run
Please Login or Register to view this content.
Got it Thanks .. Checking this now :P
Works perfect
Thanks a lots
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks