How can I input the last time the file was saved or modified into a cell?


Posted by Robert on May 22, 2001 3:36 PM

How can I input the last time the file was saved or modified into a cell? I would like to be able to do this via a formula, but if that's not possible, then by utilizing a macro.

Thanks in advance for any help given.

Posted by Kevin James on May 22, 2001 4:09 PM

Hi Robert,

There have been postings here asking how to put date/time stamp in header/footer of printed report. If this would suit you needs, use your browser's Search/Find to look for footer.

Kevin

Posted by David Hawley on May 22, 2001 5:31 PM

Hi Robert

Right click on the sheet picture, top left next to "File" and select "View Code". Paste in this code:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Cancel = True Then Exit Sub
Sheets("Sheet1").Range("A1") = Time
End Sub


Push Alt+Q to return to Excel


Dave

OzGrid Business Applications



Posted by Robert on May 23, 2001 2:24 PM

Dave,
Thank you for taking the time to help me out. Your solution worked perfectly for giving me the time, however I had to modify it as follows to give me the Time + Date (I'm enclosing just in case someone else has this problem):

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Cancel = True Then Exit Sub
Sheets("Sheet1").Range("A1") = Date + Time
End Sub

Again, many thanks for taking the time to help me out.