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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,214,923
Messages
6,122,283
Members
449,075
Latest member
staticfluids

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