VBA & Macro Problems

How to Automatically Display the Last Edited Date in Excel

Huma Ashraf ChHuma Ashraf Ch Nov 10, 2026 868 views

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.

How to Automatically Display the Last Edited Date in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA Editor

Press Alt + F11 on your keyboard to open the Microsoft Visual Basic for Applications window.

2
Select the Target Worksheet

In the Project Explorer pane on the left, double-click the specific worksheet where you want to track changes (for example, Sheet1).

3
Insert the VBA Code

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).

4
Save as a Macro-Enabled Workbook

Close the VBA editor. Go to File > Save As, and choose Excel Macro-Enabled Workbook (*.xlsm) from the format drop-down menu.

Use a VBA Macro to Auto-Update the Edit Date
Macro Security: Make sure to enable macros in your Excel Trust Center settings, otherwise the VBA script will not run when the file is reopened.
Easily Manage Spreadsheets with WPS Office

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. 1. Open Your Workbook in WPS Spreadsheet: Launch WPS Office and open your existing spreadsheet.
  2. 2. Access the VBA Editor: Go to the Tools tab on the ribbon and click Developer, then select VBA Editor.
  3. 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. 4. Save as a Macro-Enabled File: Click Menu > Save As, and choose the .xlsm format to ensure your macro runs successfully next time.
Full support for VBA macros to automate custom tracking and formatting tasks.Seamless compatibility with Microsoft Excel formats, including Macro-Enabled Workbooks (.xlsm).Lightweight, fast, and free to use with an intuitive, tabbed interface.Built-in version history features for collaborative cloud documents.
microsoft office alternative - wps office

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.