Some help with a last modified date/time problem

Diving_Dan

Board Regular
Joined
Oct 20, 2019
Messages
79
Hi all,

I'm very new to VBA and macros and am struggling to find a solution for what I would like to do.

I am using some code that i found to show the date and time that a worksheet was last modified in a given cell. This does not update on it's own. The only way that I am able to update the cell is to click into the formula bar after i have selected the cell and press enter.

I am hoping there is a way to automate it so the last modified date/time will always be up to date.

Can anyone help?
 

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,064
Right-click the sheet's tab and click View Code. Put this code in the right-hand pane:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = False
    Range("A1").Value = Now
    Application.EnableEvents = True
End Sub
Format cell A1 with the required date-time format.
 

Forum statistics

Threads
1,085,542
Messages
5,384,327
Members
401,887
Latest member
Somesh

Some videos you may like

This Week's Hot Topics

Top