Conditional formatting

  • Thread starter Thread starter Bobby
  • Start date Start date
Hi
conditional format only accepts 3 conditions though you
have a fourth
if you include the default format.

If you only want to apply different FONT colors based on
NUMBERS, you
can define up to 6 different styles. See:
http://www.mcgimpsey.com/excel/conditional6.html
for instructions how to do it

For everything else you'll need VBA code (e.g. process the
worksheet_change event and apply your format based on the
cell values).
The following will color the entry in cell A1:A100 based
on its value:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("A1:A100")) Is Nothing
Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Target
Select Case .Value
Case "Red": .Interior.ColorIndex = 3
Case "Blue": .Interior.ColorIndex = 10
'etc.
End Select
End With
CleanUp:
Application.EnableEvents = True
End Sub
 
Hi Bobby,
Three conditions per cell is the limit of Conditional Formatting.
The next step is an Even Macro like Earl said. An example
can be found in
Event Macros, Worksheet Events and Workbook Events
http://www.mvps.org/dmcritchie/excel/event.htm#case
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm

Earl Kiosterud said:
Yes, three conditions. For more, an event macro must be written.

Generally a bad idea to not have the complete question within
the body of a posting.
 
Back
Top