Confused_UK
Board Regular
- Joined
- Dec 19, 2015
- Messages
- 56
Hi all
I am looking for some VBA code to record any changes to a workbook in one worksheet called "ChangesLog".
Ideally I would like it to show the name of the individual making the change, the date and timestamp of the change, which cell in which worksheet has been changed, and the old and new values, but in a table.
I have found the code below which works very well, but would like it broken into individual cells. Does anyone have any ideas?
Thank you in advance
I am looking for some VBA code to record any changes to a workbook in one worksheet called "ChangesLog".
Ideally I would like it to show the name of the individual making the change, the date and timestamp of the change, which cell in which worksheet has been changed, and the old and new values, but in a table.
I have found the code below which works very well, but would like it broken into individual cells. Does anyone have any ideas?
Code:
[COLOR=#000000][FONT=Verdana]Dim PreviousValue[/FONT][/COLOR]
[COLOR=#000000][FONT=Verdana]Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Value <> PreviousValue Then
Sheets("log").Cells(65000, 1).End(xlUp).Offset(1, 0).Value = _
Application.UserName & " changed cell " & Target.Address _
& " from " & PreviousValue & " to " & Target.Value & " at: " & Time & " on: " & Date
End If
End Sub[/FONT][/COLOR]
[COLOR=#000000][FONT=Verdana]Private Sub Worksheet_SelectionChange(ByVal Target As Range)
PreviousValue = Target.Value
End Sub[/FONT][/COLOR]
Thank you in advance