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: Most helpful
  1. 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
  2. Anonymous
    2013-01-24T13:33:48+00:00

    MicheleR-

    Nope, it is the "Current Date", not the File Saved/Modified Date (a function that exists in MS Word).

    I really miss that capability.  I put it on all of my Word documents, in the Footer.  That way, when I look at a printout, I can compare the date on the printout with the saved/modified date on the file -- and then I KNOW that I am looking at a printout of the current saved file and not an older printout.

    This is a sorely needed function in Excel that has existed in Word for years and years.  I don't understand why MS can't put the same Insert Function capability into Excel.

    As far as I know, the only way to get the saved date is via some non-simple vba macro that must be inserted into your worksheet -- and I don't have the time or inclination to learn vba and figure out what is going on.  I really hate blindly doing things that I do not understand.

    Ron in Round Rock

    Was this answer helpful?

    0 comments No comments
  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  4. Anonymous
    2010-11-17T01:22:47+00:00

    Another way would be to use a WorksheetChangeEvent macro to cause a DateTimeCode to be written to a hidden sheet to log a change to each sheet individually........knowing only if the workbook was changed is one thing, knowing which sheet was changed in even better.

    hth

    Vaya con Dios,

    Chuck, CABGx3

    Was this answer helpful?

    0 comments No comments