I have 2 columns of data - Name (A) and Index (B) - and the following VBA, so when Index (B) is a certain value (or within a specific range) that Index (B) cell changes color:
Private Sub Worksheet_Change(ByVal Target As Range)
Set I = Intersect(Target, Range("B2:B10"))
If Not I Is Nothing Then
Select Case Target
Case 0 To 50: Newcolor = 37 'light blue
Case 51 To 100: Newcolor = 46 'orange
Case 101 To 150: Newcolor = 12 'dark yellow
Case 151 To 200: Newcolor = 10 'green
Case 200 To 250: Newcolor = 3 'red
Case "A": Newcolor = 13 'violet
Case "B": Newcolor = 54 'plum
Case "C": Newcolor = 38 'rose
End Select
Target.Interior.ColorIndex = Newcolor
End If
End Sub
This works well for multiple Conditional Format, but only changes the cell color for Index (B).
How can I modify this so the value in Index (B) will also change the cell color for Name (A) adjacent?
e.g. "215" in B5 changes cell B5 and A5 to red. (using Excel 2003)
Bookmarks