cwalenciak
New Member
- Joined
- Apr 19, 2015
- Messages
- 6
Hello. I am trying to fill a cells interior color if a condition is not met. The issue is while the columns where I am texting the condition move, the column that I want to fill does not.
So I think it the offset that I am trying to figure out how to replace. Thanks
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("O:R")) Is Nothing Then
If InStr(Target, "round") > 0 Or InStr(Target, "flat") > 0 Or InStr(Target, "square") > 0 Then
Application.EnableEvents = False
Target.Offset(0, 7).Interior.Color = xlNone
Target.Offset(0, 8).Interior.Color = xlNone
Application.EnableEvents = True
Else
Application.EnableEvents = False
Intersect(Target, Range("O:R")).Offset(0, 7).Interior.Color = RGB(165, 165, 165)
Intersect(Target, Range("O:R")).Offset(0, 8).Interior.Color = RGB(165, 165, 165)
Application.EnableEvents = True
End If
End If
End Sub
So I think it the offset that I am trying to figure out how to replace. Thanks
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("O:R")) Is Nothing Then
If InStr(Target, "round") > 0 Or InStr(Target, "flat") > 0 Or InStr(Target, "square") > 0 Then
Application.EnableEvents = False
Target.Offset(0, 7).Interior.Color = xlNone
Target.Offset(0, 8).Interior.Color = xlNone
Application.EnableEvents = True
Else
Application.EnableEvents = False
Intersect(Target, Range("O:R")).Offset(0, 7).Interior.Color = RGB(165, 165, 165)
Intersect(Target, Range("O:R")).Offset(0, 8).Interior.Color = RGB(165, 165, 165)
Application.EnableEvents = True
End If
End If
End Sub