Run Macro if - based on clock time.

ChuckRobert

Board Regular
Joined
Feb 26, 2009
Messages
64
I built a master workbook in Excel 2003 that contains production data linked in from about 20 other workbooks. The information in the master workbook needs to be archived each day as it is overwritten the following day. I have a macro that creates an archive copy in another folder, with the current date. The problem is that the macro can be cancelled with a message box. Occassionally, it is cancelled expecting someone else will archive it later in the day, but no one does. I deleted the message box from Shift 1 and Shift 2, causing it to auto-archive everytime the workbook is closed, eliminating the problem.
However, I need help with Shift 3. They come in at 10 PM. I they were to open and close the workbook before midnight, it would over-write the good archive copy from the end of their shift earlier that morning.
Cell A2 contains the current date, and cell A3 is foramted for time.
Does anyone know how can I can control the macro to reference the time and automatically run if the current time is earlier than 1 PM, but cancel if later than 1 PM on any given day?
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,144,374
Messages
5,723,983
Members
422,529
Latest member
mbilal429

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
Top