breynolds0431
Active Member
- Joined
- Feb 15, 2013
- Messages
- 303
- Office Version
- 365
- 2016
- Platform
- Windows
Hello. I have current code that will write a date to a worksheet after the code has successfully run. The code just updates sheet data from a report, which isn't relevant to this question. However, the reason the code writes the update date to the sheet is so that it can be used in a workbook_open event to check if that date is more than 7 days old. If it is, a message box will display stating how many days old the report data is and reminds the user to run another update. The update requires an external report to be run, so we can't automate this to run the update code automatically if it's been more than 7 days. The current process is working fine, but I was just wondering if the date actually needs to be written to a sheet? There are possibly some risks associated with doing that, such as the sheet being deleted or the range cleared. Could the update date be stored as a public or global variable and used in the workbook_open to check how many days it's been since the last update? I'm not really sure how public variables work or if a module code could write a public variable that a workbook open code could utilize. Thanks for reading this and your thoughts.