View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Advanced Conditional Formatting

Add a control button then in code use a Case statement

Private Sub CommandButton1_Click()
Dim I As Integer
For I = 1 To 5
Cells(I, 1).Select
Select Case ActiveCell
Case "fish"
ActiveCell.Interior.ColorIndex = 30
Case "animal"
ActiveCell.Interior.ColorIndex = 40
Case Else
ActiveCell.Interior.ColorIndex = 0
End Select
Next

End Sub
-----Original Message-----
Does anyone know how i can format the background colour

of
my cells dependent on their content. I can do this in
conditional formatting but only for 3 conditions and i
need about 20.

All i want is code that says

if cell content = fish - cell background = red
if cell content - animal - cell background = blue

etc.

Any one any ideas???
.