Hey guys
I pinched this code from another post, and tweaked it to my needs, but I now need to develop it further.
All it does is when the data is changed in column R, it inputs the date it was edited and the username that made the change to the next columns along.
What I now would like to do, it take the value that was in that range originally, copy it is a value to an adjacent column. Is this possible?
So if a user updated the Value in N1 from 31 to 67, I would like 31 to show in M1 and 67 to show in N1, Date in O1, Username in P1
Any help is greately appreciated. Thank You
I pinched this code from another post, and tweaked it to my needs, but I now need to develop it further.
All it does is when the data is changed in column R, it inputs the date it was edited and the username that made the change to the next columns along.
What I now would like to do, it take the value that was in that range originally, copy it is a value to an adjacent column. Is this possible?
So if a user updated the Value in N1 from 31 to 67, I would like 31 to show in M1 and 67 to show in N1, Date in O1, Username in P1
Any help is greately appreciated. Thank You
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim WorkRng As Range
Dim Rng As Range
Dim xOffsetColumn As Integer
Set WorkRng = Intersect(Application.ActiveSheet.Range("n:n"), Target)
xOffsetColumn = 1
If Not WorkRng Is Nothing Then
Application.EnableEvents = False
For Each Rng In WorkRng
If Not VBA.IsEmpty(Rng.Value) Then
'Rng.Offset(0,1).Value=
Rng.Offset(0, xOffsetColumn).Value = Now
Rng.Offset(0, xOffsetColumn).NumberFormat = "dd-mm-yyyy"
Rng.Offset(0, 2).Value = Environ("USERNAME")
Else
Rng.Offset(0, xOffsetColumn).ClearContents
End If
Next
Application.EnableEvents = True
End If
End Sub