My code below does a very simple task. It automatically populates 2 cells within the same row of the target when the target cell is not empty and deletes the same values when the target's value gets deleted (empty).
My issue is with the delete code. It works when I delete individual target cells but not in range (e.g., C3 to C10).
My issue is with the delete code. It works when I delete individual target cells but not in range (e.g., C3 to C10).
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Offset.Row > 5 And Target.Offset.Column = 6 Then
If Not IsEmpty(Target) Then
Target.Offset(0, -4).Value = Target.Offset.Row - 5
Target.Offset(0, -3).Value = Format(Now, "mm/dd/yyyy")
Target.Offset(0, -1).Value = Application.UserName
End If
End If
If Target.Offset.Row > 5 And Target.Offset.Column = 6 Then
If IsEmpty(Target) Then
Target.Offset(0, -4).Value = ""
Target.Offset(0, -3).Value = ""
Target.Offset(0, -1).Value = ""
End If
End If
End Sub