Hello All, I use the below code to change the color of a row of cells when a user double clicks. Problem is the row beyond the table its meant to act on is affected. Is there a way to restrict EntireRow so that it only acts within a range? Thanks!
Code:
Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Interior.Color = vbGreen Then
Cancel = True
Target.EntireRow.Interior.ColorIndex = 22
Target.Interior.Color = vbRed
ElseIf Target.Interior.Color = vbRed Then
Cancel = True
Target.EntireRow.Interior.ColorIndex = 0
Target.Interior.Color = vbYellow
ElseIf Target.Interior.Color = vbYellow Then
Cancel = True
Target.EntireRow.Interior.ColorIndex = 35
Target.Interior.Color = vbGreen
End If
End Sub