VBA to run a max of once a day

shophoney

Active Member
Joined
Jun 16, 2014
Messages
281
Hi, I'm looking to have an excel file in my windows startup group and have it run when windows loads.

But I would like to have the code ONLY run once a day.

So if the code has already run today don't run it again till it's loaded tomorrow.

I can add a Power Pivot calculated column and have it list last refresh. Would that help?

Thanks
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
The code could create a named formula contain the last run date, and not run again until that date passes.
 
Upvote 0
I like to use a hidden 'Settings' tab with this kind of info. I save the current date to a row in this hidden tab the first time the Workbook is open that day, and read the value into a Global variable each time the Workbook opens, to see if I need to run the daily routine again.
 
Upvote 0

Forum statistics

Threads
1,215,062
Messages
6,122,923
Members
449,094
Latest member
teemeren

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