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
    2016-07-14T06:41:37+00:00

    Hi, is there a solution that will enable to track the date of the external file, ie: placed in the same folder ?

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2016-06-07T16:33:04+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.

    Dinesh:  I applaud you!  Thank you... that was excellent step-by-step instructions, and exactly what I (and I suspect many people) needed!

    The only thing I would add is a reminder to format the cell:

    7.   Right click on the cell where you typed '=LastSaveDate()'

    8.   Left click on "Format Cells..."

    9.   Select the "Number" tab

    1. Select the appropriate format for your needs.  Because my document could be saved multiple times in one day, I opted to display the date and time.

    I also added an indicator to the left of the '=LastSaveDate()' to identify what the date represents... now my document displays the following:

    Last Saved:  6/7/16 12:13 PM

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2016-05-31T23:21:02+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.

    Thank you for the detailed steps!  I kept getting a number with a decimal result.....I forgot to format (Date) my cell.....RESOLVED!

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2016-04-22T04:49:01+00:00

    This sounds like what I was looking for, but how do you do it?

    Was this answer helpful?

    0 comments No comments