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: Oldest
  1. Anonymous
    2013-06-18T15:44:54+00:00

    I have just spent over 20 minutes trying to add this simple reference into my spreadsheet and give up!. Is there any feedback from Microsoft stating that they will provide an update to make this field a user friendly addition?

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-06-19T08:48:31+00:00

    please someone explain step by step what should an average excel user should do to get this VB works properly. it is not enough to just write a code and then assume that others have the same ability, and experiences that you as an expert have.

    please consider that some people have never used VB in excel.

    I personally have experienced some major problems with files containing VB codes so I prefer not use it.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-06-20T00:28:55+00:00

    Perhaps someone could post a snippet of the code as it appears in the VB script window. It took me a few tries to get this to work, but it made sense after it got working. I have the code in an Excel template, and just cut & paste the data when I need it in another file.

    I would post a snip of my file, but do not know how to upload graphics here (or if it is even possible).

    With all that said, it is RIDICULOUS that Microsoft doesn't offer this as part of an Office upgrade. God knows we get enough updates to Office every month, as part of Windows updates.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-10-06T07:41:11+00:00

    I used this VB code and found useful.

    Let me explain step by step. May be this is useful for others.

    1. open up your work sheet.
    2. Press Alt + F11. You will find a Visual Basic scree opening up.
    3. Go to 'Insert' menu and select 'Module'. you will find a screen opening up
    4. Copy the below code and paste in the window.

    Function LastSaveDate()

    Application.Volatile True

    LastSaveDate = FileDateTime(ThisWorkbook.FullName)

    End Function

    1. Save this file and close the VB window.
    2. in the cell where you want to insert the last saved date type

       = LastSaveDate()

    and save the exel file.

    It works right without any problem.

    Was this answer helpful?

    9 people found this answer helpful.
    0 comments No comments