Archive of Mr Excel Message Board

Back to Dates in Excel archive index
Back to archive home

Alerting user to outdated data
Posted by Dale H. on May 04, 2001 8:01 AM
Hello!
I'm trying to construct an Auto_Open macro that will
compare the date a workbook was last saved to today's
date. If it's more than seven days old, Excel will
tell the user something like "Data older than 7 days,
possibly obolete."
There must me a simple way of capturing the last date
saved and comparing it to Now().
Any suggestions?
Thank you in advance!
-Dale H.

Re: Alerting user to outdated data
Posted by Gregc on May 04, 2001 9:39 AM
Try this
Private Sub Workbook_Open()
DateUpdated = Sheet1.Range("a1") 'this is the date the worksheet was last changed let me know if you need help with that
DateDif = Now() - DateUpdated
If DateDif > 5 Then
MsgBox "This file is too old"
End If
End Sub

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our
online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.