Hi All,
I received some excellent code from Xlnitwit which I've edited to involve 2 colours when formatting. However, I would like to edit further
so that, rather than selecting specific ranges for formatting, I would like to affect 5 cells to the left (B5:F5) and one cell to the right (H5).
As I'm sure you can see, the cell changes green when "COMP" is added and red when "INCOMP" is added. Here's the code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("G5")) Is Nothing Then
If Range("G5").Value2 = "COMP" Then
Range("B5:I5").Interior.Color = vbGreen
End If
If Range("G5").Value2 = "INCOMP" Then
Range("B5:I5").Interior.Color = vbRed
End If
If Range("G5").Value2 = "" Then
Range("B5:I5").Interior.Color = xlColorIndexNone
End If
Else
Range("B5:I5").Interior.ColorIndex = xlColorIndexNone
End If
End Sub
Bookmarks