More than 3 rules of conditional formatting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any ways to have more than 3 formats with conditional formatting?
I've been thinking about styles, but i dont know if i can change a style of
a cell with formulas.
Any suggestions?
 
Hi,

I'm not sure about styles but you can do it using the worksheet_change
event. Right click the sheet tab and view code and paste this in. Add as many
conditions as you like:-

Private Sub Worksheet_Change(ByVal Target As Range)
Const myRange As String = "A1:B20"
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(myRange)) Is Nothing Then
With Target
Select Case .Value
Case Is > Range("F1"): .Interior.ColorIndex = 46 'Orange
Case 2: .Interior.ColorIndex = 3 'Red
Case 3: .Interior.ColorIndex = 6 'Yellow
Case 4: .Interior.ColorIndex = 10 'Green
End Select
End With
End If
Application.EnableEvents = True
End Sub
 
Back
Top