Add the following code at the beginning of your existing code. It will
create an hidden defined name called "LastRun" containing the date on
which the code was executed.
Dim D As Date
Dim S As String
Dim Nm As Name
On Error Resume Next
Set Nm = ThisWorkbook.Names("LastRun")
If Err.Number <> 0 Then
ThisWorkbook.Names.Add "LastRun", Int(Now), False
Else
S = Nm.RefersTo
S = Mid(S, 2)
D = CDate(S)
Debug.Print "Last Run: " & D, "Days between: " & Int(Now) - D
End If
ThisWorkbook.Names.Add "LastRun", Int(Now), False
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)