The code below is used to recognise when a change occurs on any sheet in the workbook. Then on the sheet where the changes happened, show the date + time in cell B1
and the user who made the change in D1
.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
With Sh
If Intersect(Target, Range("A1:D1")) Is Nothing Then
ActiveSheet.Range("B1").Value = Format(Now(), "dd/mm/yyyy - hh:mm:ss")
ActiveSheet.Range("D1").Value = Application.UserName
Else
End If
End With
End Sub
But the code errors when trying to action somehing like copy+paste cells in one sheet or across 2
Tried looking for solutions and using different syntax (like wsPOD
instead of Activesheet
) but either errors with same actions or errors on any change.