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
    2013-12-23T12:12:38+00:00

    Thanks - that would work great, but there is one huge extra problem I've discovered:

    If you want to share your workbook, this will not work. At all.


    :(

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-11-19T21:04:01+00:00

    Thank you, Dinish!  Step 1., Step 2....exactly what I needed in the amount of time I have!

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-11-05T13:08:26+00:00

    Thanks, Dinesh. I added the brackets as you suggested and that still did not work. I finally got it to work once I had enabled macros. This may have been an obvious step to most people, but I'm new at writing code in Excel. (For anyone else who is not familiar with this: to enable macros in Word 2010, go to the ribbon's Developer tab, then Macro Security in the Code section, and Enable all macros. Note that this could reduce the security of your PC).

    Now the code works perfectly (but should definitely be a standard formula in Excel!). Thanks again.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  4. Anonymous
    2013-10-21T16:56:02+00:00

    I believe you missed to type the opening and closing brackets after LastSaveDate.

    It should be

      = LastSaveDate()

    I tried without the brackets and it showed me the error as your stated (#Name? error). Please try with the brackets.

    More over I'm trying with older version of excel. Hope it works in the recent versions also.

    Was this answer helpful?

    0 comments No comments