Villalobos
Active Member
Hello,
Now I using the below mentioned code to check "what" "from" "to" "when" "on which sheet" the modifications/sheet. There are many sheet in my file and I not would like to place on every sheet this code. I would like to simplify... and my target is that only one code which is able to handle the all modifications on all sheets.
Public varPValue As Variant
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Errb As Integer
On Error GoTo ErrTrap:
If Target.Value <> varPValue Then
With Sheets("log").Cells(65000, 1).End(xlUp)
.Offset(1, 0).Value = Application.UserName
.Offset(1, 1).Value = "Modified cell:"
.Offset(1, 2).Value = Target.Address
.Offset(1, 3).Value = "Previous data:"
.Offset(1, 4).Value = varPValue
.Offset(1, 5).Value = "New data:"
.Offset(1, 6).Value = Target.Value
.Offset(1, 7).Value = "When:"
.Offset(1, 8).Value = Now()
.Offset(1, 9).Value = "Modified sheet"
.Offset(1, 10).Value = ActiveSheet.Name
End With
End If
Exit Sub
ErrTrap:
ErrNum = Err
If ErrNum = 13 Then
Resume Next
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
varPValue = Target.Value
End Sub
Can someone suggest anything how should I modify the code?
Thanks in advance!
Now I using the below mentioned code to check "what" "from" "to" "when" "on which sheet" the modifications/sheet. There are many sheet in my file and I not would like to place on every sheet this code. I would like to simplify... and my target is that only one code which is able to handle the all modifications on all sheets.
Public varPValue As Variant
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Errb As Integer
On Error GoTo ErrTrap:
If Target.Value <> varPValue Then
With Sheets("log").Cells(65000, 1).End(xlUp)
.Offset(1, 0).Value = Application.UserName
.Offset(1, 1).Value = "Modified cell:"
.Offset(1, 2).Value = Target.Address
.Offset(1, 3).Value = "Previous data:"
.Offset(1, 4).Value = varPValue
.Offset(1, 5).Value = "New data:"
.Offset(1, 6).Value = Target.Value
.Offset(1, 7).Value = "When:"
.Offset(1, 8).Value = Now()
.Offset(1, 9).Value = "Modified sheet"
.Offset(1, 10).Value = ActiveSheet.Name
End With
End If
Exit Sub
ErrTrap:
ErrNum = Err
If ErrNum = 13 Then
Resume Next
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
varPValue = Target.Value
End Sub
Can someone suggest anything how should I modify the code?
Thanks in advance!