Hello Guys,
I was able to put two codes together and it worked for me, but when I tried to insert another line, it gave me an error. I am unable to fix that error. Can you please help me? The error message is :
The line in red is the one that triggered that error message. How can I fix that?
Any help is appreciated.
Asad
I was able to put two codes together and it worked for me, but when I tried to insert another line, it gave me an error. I am unable to fix that error. Can you please help me? The error message is :
The actual code is:Error in Worksheet Change Event Code: Application-defined or Object-defined error
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, c As Range
Dim Counter As Long
For Counter = 1 To Selection.Rows.Count
If Counter Mod 2 = 1 Then
Selection.Rows(Counter).Interior.ColorIndex = 15
End If
Next Counter
On Error GoTo Handler
Application.EnableEvents = False
Set rng = Intersect(Target, Range("I4:BC200"))
If rng Is Nothing Then
GoTo My_Exit
Else
For Each c In rng
Select Case c.Value
Case "RDO"
c.Interior.ColorIndex = 19
c.Font.ColorIndex = 41
c.Font.Bold = True
Case "OFF"
c.Interior.ColorIndex = 35
Case "1", "2", "4", "128", "139", "142", "143", "145", "749"
c.Interior.ColorIndex = 45
[COLOR=red][B]Case c.Value <> c.Offset(, -8).Value
c.Font.ColorIndex = 3
[/B][/COLOR]
End Select
Next c
End If
My_Exit:
Application.EnableEvents = True
Exit Sub
Handler:
MsgBox "Error in Worksheet Change Event Code: " & Err.Description
Resume My_Exit
End Sub
Any help is appreciated.
Asad