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-08-22T15:43:29+00:00

    Dear mlb70,

    Excel is part of the Office package, of which Word and PowerPoint are companions, and customers use the correct component for the task at hand.  One of the advantages of a package is that the components work similarly so that learning time is reduced, and the workers can produce documents that meet expectations of their bosses.  One expectation is knowing what date the document, spreadsheet, or presentation was updated, and as bosses tend to be, they want to know by glancing at the document, not by chasing down the worker.

    MY POINT is that was that component E doesn't work the same way as component W or P;  E is an exception, it is outnumbered.  Further, it has the ability surely within reach for normal, NON-MACRO, security-conscious users.

    This is not an argument of whether it CAN be done, it is an argument for making it EASILY done by those who use OFFICE.  Those who bury their head in Excel to the exclusion of fellow components, much less other offerings in the world, are doomed to fail.

    As much as Microsoft seems to pride itself on being all things to everybody, providing many ways to accomplish the same thing, in many languages and cultures, I find it interesting that there is so much resistance to this easy fix, which would provide the same feature customers can find when they look to the left (W) or right (P).  Perhaps Mr. Nadella hasn't shaken things up enough yet.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2015-08-20T12:55:17+00:00

    This was an Excel question, not Word. Good try though.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2015-08-04T18:24:31+00:00

    While responders are trying to be helpful, the issue is that Word provides an NON-MACRO way to put the date/time the document was saved:  Insert tab --> Header, click at the location you want the Saved Date, which will show the "Header & Footer Tools" tab, with the "Design" tab below it.  You can then click on the "Document Info" drop-down and select "Field..."

     While it may take several steps to get there, it is still much more accessible than diving down into programming macros.  It is already in Word and PowerPoint, which indicates the value of having it.

    And I'll add that not having to re-learn how to use the Office members is what makes them "sticky" over open-source alternatives; employers don't have to train (or re-train) employees.  What they learn in Word should transfer to Excel, PowerPoint, Publisher -- you get the idea.  This improves productivity for tasks that aren't performed frequently, but a boss may ask his assistant to perform:  "Make all my spreadsheets, documents, presentations look uniform, no matter who produced them, INCLUDING WHEN THEY WERE LAST MODIFIED; I want to know what has changed over time to show our progress."

    <sarcasm> Then again, maybe that doesn't matter. </sarcasm>

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2015-08-04T13:44:48+00:00

    Hi,

    there is an issue when using Chris function with XLS files, as Excel changes the last modified date temporarilywhen XLS files are opened :

    https://support.microsoft.com/en-us/kb/826741#/en-us/kb/826741

    Excel does not alter XLSX and XLSM file dates.

    So, these methods have issues :

    • Scripting.FileSystemObject's method GetFile(Thisworkbook.FullName)
    • Thisworkbook.dateLastModified

    They will show incorrect dates if you apply them on XLS files.

    I suggest to prefer

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

    as this value is not temporarily altered by Excel.

    Was this answer helpful?

    0 comments No comments