Insert the date an Excel Workbook was last modified.

Anonymous
2010-11-17T00:13:29+00:00

Is there a way to insert, into a cell, the date that a workbook was last modified?

Perhaps by getting the modified date from the file's properties into a cell.

Thanks in advance.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Anonymous
2010-11-17T00:29:39+00:00

Hi,

To modify a workbook you have to save it so we can use the before_save event

ALY+F11 to open vb editor. Double click 'ThisWorkbook' and paste this code in on the right. Change the sheet and range to suit

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

Sheets("Sheet1").Range("A1").Value = Now

End Sub


If this post answers your question, please mark it as the Answer.

Mike H

Was this answer helpful?

100+ people found this answer helpful.
0 comments No comments

86 additional answers

Sort by: Newest
  1. Anonymous
    2015-07-29T06:47:10+00:00

    This help page support get last modified for thisworkbook.

    how with another no active workbook???

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2015-06-15T14:14:02+00:00

    Hi AdyImp,

    I had the same result and tried Pierre69F's suggestion by using the following code:

    Private Function LastSaveDate()

    Application.Volatile

    LastSaveDate = ""

    On Error Resume Next

    LastSaveDate = ThisWorkbook.BuiltinDocumentProperties("Last Save Time").Value

    ' In a cell enter: =lastsavedate()

    ' This macro must be stored in a module; not in a sheet

    End Function

    Worked a treat.

    Also make sure your cell is formatted to display the date serial number in the format your prefer.

    Cheers

    Antshark

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2015-03-31T21:25:07+00:00

    The NOW() function is inadequate.

    1. Now() changes every time you simply open/view the sheet (depending on how options are set)
    2. What is needed is a the date/time the sheet was LAST MODIFIED, not viewed.  This is important in letting those who see the information know when it was last changed ("are we ALL looking at the SAME information?").  Putting it in the header/footer also means that saving as a PDF (which uses the header/footer info) for electronic distribution will also be correct, and not need macros.
    3. This functionality is already in Word, thus in the Office suite.  It is simply missing from Excel.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2015-03-31T14:58:19+00:00

    This works great and you don't need to turn on any macros to use.  Thanks!

    Was this answer helpful?

    0 comments No comments