Hi everyone,
i need a help with the VBA code, that should insert the current date and username as soon as the word "done" is inserted in some of the cells in the column S.
It works until I delete or insert a new row. Then I get the Issue ´13´ and the line with If Target.Value ="done" is highlighted.
Can you help me to adjust the code, so it works without any Issue? Thank you in advance!
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("S:S")) Is Nothing Then
If Target.Value = "Done" Then
Target.Offset(0, 7).Value = Date
Target.Offset(0, 8).Value = Environ("username")
Else
Target.Offset(0, 7).ClearContents
Target.Offset(0, 8).ClearContents
End If
End If
End Sub
i need a help with the VBA code, that should insert the current date and username as soon as the word "done" is inserted in some of the cells in the column S.
It works until I delete or insert a new row. Then I get the Issue ´13´ and the line with If Target.Value ="done" is highlighted.
Can you help me to adjust the code, so it works without any Issue? Thank you in advance!
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("S:S")) Is Nothing Then
If Target.Value = "Done" Then
Target.Offset(0, 7).Value = Date
Target.Offset(0, 8).Value = Environ("username")
Else
Target.Offset(0, 7).ClearContents
Target.Offset(0, 8).ClearContents
End If
End If
End Sub