Running macros at a specific time

macsloth

New Member
Joined
May 13, 2003
Messages
6
Hi there,

I was wondering if there is a way I can get a macro to run at a specific time every day?

Would really appreciate any suggestions! Thanks!

Cheers,

Julian Wee
 
hi paul,

that's a good point. although i don't think there will be a sequencing problem as the macros are independent of each other, but all the same, i think i'll stagger them.

thanks so much for the help!!
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
All,

InThisWorkbook I have the below code

Private Sub Workbook_Open()
Application.OnTime TimeValue("08:50:00"), "workaround"
Application.OnTime TimeValue("19:40:00"), "Table_email"
End Sub

In the module, I have these macros


This file is always kept open, but for some reason, these 2 codes are not triggered.
Why?
 
Upvote 0
Hi Paul,

it works! thanks so much! just one more question, if i want to set it to run a few macros at that fixed time, i just put in 'Thisworkbook'

Private Sub Workbook_Open()
'Run PHPNDF at 4.30pm
Application.OnTime TimeValue("16:30:00"), "PHPNDF"
'Run TWDNDF at 4.30pm
Application.OnTime TimeValue("16:30:00"), "TWDNDF"
End Sub

with PHPNDF and TWDNDF being the 2 macros i need to run. Is that right?

julian

For all who are curious about this question

Hi Julian,

You cannot run both the macro at exact same time, as the process time may differ,
instead just use this,

Private Sub Workbook_Open()
'Run PHPNDF at 4.30pm
Application.OnTime TimeValue("16:30:00"), "PHPNDF"
'Run TWDNDF once PHPNDF is completed
Call TWDNDF
End Sub

Bcoz, the TWDNDF process will start only once the PHPNDF is done, and you can expect the system time to be "16:30:00"
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,557
Members
449,088
Latest member
davidcom

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