Using 2 timers, possible or not

Diephoha

New Member
Joined
May 5, 2016
Messages
31
Hi All,

I got the following code:
Private Sub Workbook_Open()

Application.OnTime Now + TimeValue("00:02:00"), "SaveThis"

Application.OnTime TimeValue("23:43:00"), "CopyWorkbook"

End Sub

The first line runs every 2 minutes and that works.
Then at a specific time another macro should run at 23:43 but it doesn't.
Is it possible to have 2 timers running at the same time?
If not, what else can i do to make it run?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
do you monitor the timestamps of the 2 minute operations, though it will be pretty reliable, how much do they drift
 
Upvote 0
Hi Mole999,
I did monitor it by looking at the time stamp on the files.
The 2 minute macro "savethis" runs well and when i look at the timestamp i can see it has updated with 2 minutes, so far so good.
When i wait for the clocktime of the second line to run macro "copyworkbook" it never runs it. When i look at the timestamp it never changes.

So i am wondering if it is possible to run these 2 lines together or does it only run the first one and never the second one because the first is actively running?
 
Upvote 0
i'm not totally hopeful, what happens if you swap over the two procedures so the copy is listed first
 
Upvote 0
By changing the order it seems to work.
Mybe it is because a timer runs all the time so blocking the next line.
And the one with the clocktime only checks the systemtime and if its time it runs the macro, i imagine.

Thank you for pointing me in the right direction.
 
Upvote 0

Forum statistics

Threads
1,215,011
Messages
6,122,677
Members
449,092
Latest member
tayo4dgacorbanget

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top