Conditional Formating excel 2k

G

Genc

Is possible to have more that three conditions in one cell?
beacuse after 3rd condition you can't add a nother.
I need the fill colour of the cell to change not the text.
-If the cell value is:
1-5 red
5-10 orange
10-15 yellow
15-20 bright Green
20+ Green

Thanks Genc
 
B

Bob Phillips

Genc,

No you need VBA for this

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:H10")) Is Nothing Then
With Target
Select Case .Value
Case 1, 2, 3, 4, 5: .Interior.ColorIndex = 3 'red
Case 6, 7, 8, 9, 10: .Interior.ColorIndex = 46 'orange
Case 11, 12, 13, 14, 15: .Interior.ColorIndex = 6 'yellow
Case 16, 17, 18, 19, 20: .Interior.ColorIndex = 4 'bright
green
Case Is > 20: .Interior.ColorIndex = 10 'green
End Select
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top