Excel: How can I add "Last Modified" to Excel

Terry Seagert 101 Reputation points
2021-11-02T13:44:49.91+00:00

Excel: How can I add "Last Modified date" in a cell on an Excel spreadsheet every time I save it? Office 2019

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,455 questions
Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,638 questions
0 comments No comments
{count} votes

13 answers

Sort by: Most helpful
  1. Emily Hua-MSFT 27,526 Reputation points
    2021-11-03T02:59:08.587+00:00

    @Terry Seagert

    Excel does not have "SaveDate" field like Word, to achieve your needs, the VBA code could be helpful.

    As tag "office-excel-itpro" focuses more on general issues of Excel client, VBA code is out of my support scope, to better help you, I would add the tag "office-vba-dev". Thanks for your understanding.

    Personlly, I find the command "FileDateTime" function, you could have a try. If your run following vba, you could get the last modified date and time into the A1. If you want to get the date and time in other cell, I suggest you replace "A1" with a cell you need.

    Sub LmodFile()
    Range("A1").Value = FileDateTime("File Path")
    End Sub

    145983-untitled2.png

    Hope the information could be helpful.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    0 comments No comments

  2. Terry Seagert 101 Reputation points
    2021-11-03T15:02:04.623+00:00

    Thanks for your help.
    I tried to insert the VBA but it did not work. I must have missed something.
    Here is an image of my script

    146254-vba.jpg


  3. Terry Seagert 101 Reputation points
    2021-11-07T12:50:42.277+00:00

    Well I do not know why, but it does not work for me.

    0 comments No comments

  4. Tom van Stiphout 1,621 Reputation points MVP
    2021-11-07T14:39:21.993+00:00

    Do you realize why that is? LoadFile is a procedure in a standard module. That's fine. But there is nothing that calls this procedure.
    Excel and other COM based apps have an Event model: many user actions trigger events which you can use to run your code.
    In your case you want the date to change after each save.
    So open the VBA editor (Alt+F11), open the "ThisWorkbook" module, in the dropdowns at the top choose Workbook and AfterSave.
    Then call your procedure from there.

    0 comments No comments

  5. Terry Seagert 101 Reputation points
    2021-11-07T14:56:08.827+00:00

    Thanks
    I do not see "AfterSave" in the Workbook list. Maybe I'm missing it. See image147102-workbook.jpg

    0 comments No comments