Hi guys
I have this code which automatically runs when a cell in column J is populated from a drop down box, which works fine.
But if I type anything in any of the adjacent cells or delete any text in any adjacent cells it comes up with a run time error and I am not sure if it is my code or just something simple (like me.....lol).
It never used to come up with this error until I put the code in?
Does anyone have an idea what this could be? Many Thanks.
I have this code which automatically runs when a cell in column J is populated from a drop down box, which works fine.
But if I type anything in any of the adjacent cells or delete any text in any adjacent cells it comes up with a run time error and I am not sure if it is my code or just something simple (like me.....lol).
It never used to come up with this error until I put the code in?
Does anyone have an idea what this could be? Many Thanks.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim WorkRng As Range
Dim Rng As Range
Dim xOffsetColumn As Integer
Set WorkRng = Intersect(Application.ActiveSheet.Range("J:J"), Target)
xOffsetColumn = 11
If WorkRng = "COMPLETE" Then
Application.EnableEvents = False
For Each Rng In WorkRng
If Not VBA.IsEmpty(Rng.Value) Then
Rng.Offset(0, xOffsetColumn).Value = Now
Else
Rng.Offset(0, xOffsetColumn).ClearContents
End If
Next
Application.EnableEvents = True
End If
End Sub