totn Excel

MS Excel: Function that returns Last Modified date for Workbook

This Excel tutorial explains how to write a macro that returns the last modified date for the Wookbook and displays that date value in a cell (with screenshots and step-by-step instructions).

Question: In Microsoft Excel, how can I autoupdate a date on an Excel worksheet to the Last Modified Date?

Answer: There is no built-in function in Excel that will return the last modified date of an Excel Workbook (ie: Excel file). However, you can create a Macro function that will return this value.

Let's show you how to do this.

Download Example

First, open the Visual Basic editor by pressing Alt+F11. Then create a new module by selecting Module under the Insert menu.

Microsoft Excel

Paste the following macro code into the new module:

Function LastModified() as Date

   LastModified = ActiveWorkbook.BuiltinDocumentProperties("Last Save Time")
   
End Function

And click on the Save button (button looks like a disk).

Microsoft Excel

Now return to the worksheet and click on the cell where you would like to display the last modified date. Paste the following formula into the cell:

=LastModified()

Microsoft Excel

In this example, we have pasted the LastModified() function in cell A2. Now cell A2 should always display the last modified date. In this example, it displays 1/29/2016 as the date the workbook file was last modified.