-
write changes in log
Hello,
I "found" this vba code to log changes. It works fine if 1 cell is changed, but if several cells are changed simultaneous an error occurs.
What must i edit to make it work?
[VBA]
[FONT='Verdana','sans-serif']Dim PreviousValue
Private Sub Worksheet_Change(ByVal Target As Range)[/FONT]
If target.row > 203 and target.row < 284 and target.column > 4 and target.column < 394 then
[FONT='Verdana','sans-serif']
If Target.Value <> PreviousValue Then
Sheets("log").Cells(65000, 1).End(xlUp).Offset(1, 0).Value = _
Application.UserName & " verandert cel " & Target.Address _
& " in werkblad ' " & Me.Name & " ' van " & " ' " & PreviousValue & " ' " & "naar " & " ' " & Target.Value & " ' " & " op tijdstip " & Time & " en datum " & Date
End If[/FONT]
End if
[FONT='Verdana','sans-serif']
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
PreviousValue = Target.Value
End Sub[/FONT]
[/VBA]
Ger
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules