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
    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
  2. 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
  3. Anonymous
    2016-01-29T18:36:33+00:00

    This was very helpful. I didn't try it in sharepoint but I was able to use it in a shared network drive. However it didn't let me use the Excel share workbook function so only one person can edit at a time.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2015-10-28T16:33:14+00:00

    hi mate.

       can you please be more specific how can this be done? i mean step by step, what code needs to be written down and  so on.

       it would be very helpful to get the modified date for each sheet/tab, not only for the workbook.

    thanks in advance for your response.

    Was this answer helpful?

    0 comments No comments