Hi,
I had a code which auto update time & date on Col E
and last modified userid on col F.
Possible to rec which is the last modified cell?
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD]abc[/TD]
[TD]def[/TD]
[TD]ghi[/TD]
[TD]jkl[/TD]
[TD]8/9/2019 5:03:51 PM[/TD]
[TD]C:\Users\TOM , update Cell A, B, C,D[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I had a code which auto update time & date on Col E
and last modified userid on col F.
Possible to rec which is the last modified cell?
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD]abc[/TD]
[TD]def[/TD]
[TD]ghi[/TD]
[TD]jkl[/TD]
[TD]8/9/2019 5:03:51 PM[/TD]
[TD]C:\Users\TOM , update Cell A, B, C,D[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
' Code to put the date of the latest update following a change in the corresponding cell in column F
Dim WorkRng As Range, roww As Long
Dim rng As Range
Set WorkRng = Intersect(Range("A:D"), Target)
If Not WorkRng Is Nothing Then
Application.EnableEvents = False
For Each rng In WorkRng
roww = rng.Row
If Not rng.Value = "" Then
Cells(roww, "E").Value = Now
Cells(roww, "E").NumberFormat = "dd-mm-yyyy, hh:mm:ss"
Cells(roww, "F").Value = Environ$("Userprofile")
Else
Cells(roww, "E").ClearContents
Cells(roww, "F").ClearContents
End If
Next
Application.EnableEvents = True
End If
End Sub