Greetings: I've been searching thru the Message Board CD (which is great by the way) for some help with Conditional Formatting. I am trying to apply conditional formatting with 5 (or more) rules, but covering various ranges in the same worksheet. I found the following VBA which does the trick, but it's limited to a single cell. I've tried to expand it to cover a range, but no luck and many colorful errors. The VBA would limit the formatting to the desired ranges (like the second row of the code limits it to cell A1). Any suggestions greatly appreciated. Thanks.
Sandman
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$A$1" Or Target.Cells.Count > 1 Then Exit Sub
Select Case [A1].Value
Case "A"
Target.Interior.ColorIndex = 3
Case "P"
Target.Interior.ColorIndex = 6
Case "B"
Target.Interior.ColorIndex = 8
Case "T"
Target.Interior.ColorIndex = 22
Case "R"
Target.Interior.ColorIndex = 25
Case Else
Target.Interior.ColorIndex = 15
End Select
End Sub
Sandman
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$A$1" Or Target.Cells.Count > 1 Then Exit Sub
Select Case [A1].Value
Case "A"
Target.Interior.ColorIndex = 3
Case "P"
Target.Interior.ColorIndex = 6
Case "B"
Target.Interior.ColorIndex = 8
Case "T"
Target.Interior.ColorIndex = 22
Case "R"
Target.Interior.ColorIndex = 25
Case Else
Target.Interior.ColorIndex = 15
End Select
End Sub