hi
i have wrote following code for get the last modified date of a cell.but the problem is whenever i double click on that cell it changes the date.but i want this macro to run if i changed existing value only.
please help on this.
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub If Target.Column <> 5 Then Exit Sub Target.Offset(0, 1) = Now End Sub
Doble clicking only selects the cell for editing. If you press cancel, it won't put anything in.
You can avoid the issue by including a further check:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub If Target.Column <> 5 Then Exit Sub If Target.Value = "" Then Exit Sub Target.Offset(0, 1) = Now End Sub
Regards
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks