More than 3 Conditions

J

John Moore

Hi, I am looking for a code which will do the following for me

Range is T5:T90
Condition 1: If Cell value is >10 make background light blue
Condition 2: If cell value is between -10% and -20% make background yellow
Condition 3: If cell value is < -20% make background red
Condition 4: If cell value is < 10% but > 0% make background green.
 
J

Jarek Kujawa

Excel 2003

Sub cus
Dim cell as Range

For Each cell in Range("T5:T90").Cells
If cell.Value>10 Then
cell.Interior.ColorIndex = 8
Elseif cell.Value>=20% and cell.Value=<10% Then
cell.Interior.ColorIndex = 6
Elseif cell.Value<20% Then
cell.Interior.ColorIndex = 3
Elseif cell.Value>0 and cell.Value<10% Then
cell.Interior.ColorIndex = 50
End If
Next cell

End Sub
 
L

Luke M

Since your conditions cover all possible values of the cells you can "fake"
the 4th condition. Set conditional formats for condtions 2, 3, and 4. Make
the natrual fill color of the cells light blue.
 

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