Private Sub Worksheet_Change(ByVal Target As Range)
Dim WorkRng1 As Range
Dim WorkRng2 As Range
Dim WorkRng As Range
Dim Rng As Range
Dim xOffsetColumn As Integer
Set WorkRng1 = Intersect(Application.ActiveSheet.Range("J:J"), Target)
Set WorkRng2 = Intersect(Application.ActiveSheet.Range("L:L"), Target)
If Target.Column = 1 Then
Target.Offset(, 13).Value = Environ("Username")
End If
If Not WorkRng1 Is Nothing Then
If Not WorkRng2 Is Nothing Then
Set WorkRng = Application.Union(WorkRng1, WorkRng2)
Else
Set WorkRng = WorkRng1
End If
Else
If Not WorkRng2 Is Nothing Then
Set WorkRng = WorkRng2
End If
End If
xOffsetColumn = 1
If Not WorkRng Is Nothing Then
Application.EnableEvents = False
For Each Rng In WorkRng
If Not VBA.IsEmpty(Rng.Value) Then
Rng.Offset(0, xOffsetColumn).Value = Now
Rng.Offset(0, xOffsetColumn).NumberFormat = "mm-dd-yyyy, hh:mm:ss"
Else
Rng.Offset(0, xOffsetColumn).ClearContents
End If
Next
Application.EnableEvents = True
End If
End Sub