Last Mod Date

  • Thread starter Thread starter GWB
  • Start date Start date
G

GWB

I would like to update a cell with the "Last-Modified" date so that when I
load the spreadsheet, the last time I changed it shows. Whats the best way
to access that?

Thanks
 
You can use this in the thiswoorkbook module

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
'If you save the file the date/time will be placed in cell A1 of Sheet1
Sheets("Sheet1").Range("A1").Value = Format(Now, "yyyy-mmm-dd hh:mm:ss")
End Sub
 
I'm guessing this would work....

Private Sub Workbook_Open()
Worksheets("Sheet1").Range("A1").Value = _
FileDateTime(ThisWorkbook.Path & "\" & ThisWorkbook.Name)
End Sub

Change the worksheet and cell references to match your actual conditions.

Rick
 
Back
Top