Hi guys, you know any code to generate automatically the date of modification of one cell?
AUTOMATIC DATE
-
-
-
Add the date into a cell comment like this
CodeSub DateModified() On Error Resume Next With ActiveCell .ClearComments On Error GoTo 0 .AddComment .Comment.Text Text:="Modified on: " & Format(Date, "long date") .Comment.Visible = False End With End Sub
If you want it to be automatic then you could use a worksheet event
Code
Display MorePrivate Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next With Target If .CountLarge > 1 Then Exit Sub .ClearComments On Error GoTo 0 .AddComment .Comment.Text Text:="Modified on: " & Format(Date, "long date") .Comment.Visible = False End With End Sub
If you aren't sure how to use event code then read this
-
So good your code, its work, how can I make it work only in the column O?
-
Try this
Code
Display MorePrivate Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next With Target If .CountLarge > 1 Or .Column <> 15 Then Exit Sub .ClearComments On Error GoTo 0 .AddComment .Comment.Text Text:="Modified on: " & Format(Date, "long date") .Comment.Visible = False End With End Sub
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!