How to Automatically Display the Last Edited Date in Excel
Question details
The user wants to know if there is a way to automatically display the date when a worksheet was last modified or edited directly inside a specific Excel cell.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Tracking document updates or auditing changes by displaying the most recent edit timestamp on the spreadsheet.
- Observed behavior
- By default, Excel tracks changes via Show Changes or Version History, but does not automatically write the last edited date into a specific cell without a VBA script or manual tracking.
Decide whether you just need to view the edit history or if you need the date explicitly printed in a cell. If you need the date displayed in a cell automatically, you will need to enable macros and save your workbook in a macro-enabled format.
Use a VBA Macro to Auto-Update the Edit Date
This method uses a simple VBA script to automatically insert the current date and time into a specific cell whenever any change is made to the worksheet.
Since Excel does not have a built-in formula to track the last edited timestamp inside a cell, using VBA (Visual Basic for Applications) is the most reliable workaround. The script relies on the Worksheet_Change event, which triggers whenever a specified range or the entire sheet is modified.
Press Alt + F11 on your keyboard to open the Microsoft Visual Basic for Applications window.
In the Project Explorer pane on the left, double-click the specific worksheet where you want to track changes (for example, Sheet1).
Copy and paste the following code into the code window: Private Sub Worksheet_Change(ByVal Target As Range) Range("A1").Value = Now End Sub (Change "A1" to whichever cell you want the date to appear in).
Close the VBA editor. Go to File > Save As, and choose Excel Macro-Enabled Workbook (*.xlsm) from the format drop-down menu.

View the Edit History Using Show Changes
If you only need to audit changes and do not require the date to be printed in a specific cell, Excel's built-in tracking features can help.
Track Worksheet Updates Seamlessly in WPS Spreadsheet
WPS Spreadsheet supports advanced VBA macros, allowing you to automate tasks like recording the last edited date with ease. It is fully compatible with Microsoft Excel files, providing a seamless editing and auditing experience.
- 1. Open Your Workbook in WPS Spreadsheet: Launch WPS Office and open your existing spreadsheet.
- 2. Access the VBA Editor: Go to the Tools tab on the ribbon and click Developer, then select VBA Editor.
- 3. Apply the Tracking Script: Double-click your target sheet in the Project Explorer and insert the Worksheet_Change event code to log the current date.
- 4. Save as a Macro-Enabled File: Click Menu > Save As, and choose the .xlsm format to ensure your macro runs successfully next time.

Frequently Asked Questions
Can I display the last edited date without using a VBA macro?
You can use the built-in 'Show Changes' or 'Version History' features to see when a file was last modified, but automatically displaying that specific date inside a worksheet cell requires a VBA script.
Why isn't my VBA script updating the date when I make changes?
Ensure that you have saved the file as a Macro-Enabled Workbook (.xlsm) and that macros are enabled in your Excel security settings. Also, verify that the VBA code is placed in the specific Worksheet module in the editor, rather than a standard module.
How do I track the last saved date instead of the last edited date?
To track the last saved date, you can use the Workbook_BeforeSave event. In the VBA editor, double-click 'ThisWorkbook' and add code to write the current date (using the 'Now' function) into your desired cell right before the file is saved.
Are VBA macros safe to use for tracking dates?
Yes, macros you write yourself are completely safe. However, you should always be cautious when enabling macros in files downloaded from unknown sources on the internet.




