colour based on value

shadow12345

Well-known Member
Joined
May 10, 2004
Messages
1,238
I am using the 2003 version of excel and would like to colour the sheet based on the value in coloum c&d

if c1 = 2 then red
if c2 = 1 then yellow

and so on

i need to have one colour for each number (number will be either 1,2,3,4) how could i do that ?
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
if you wish to colour the whole sheet (strange but each to their own!) follow this:- Click the blank grey square next to A and 1 then click Format, Conditional Formatting, where it says Cell Value Is click the dropdown and choose Formula Is, then in the box next to it place this =$C$1=2 then click on the Format button and choose your colour, if you want to add another format click Add do as above but change the values after C to suit your needs.

Regards,
Simon

P.s here's the VBA version
Code:
Sub StdCondFormat()
    Cells.Select
    Selection.FormatConditions.Delete
    Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$C$1=2"
    Selection.FormatConditions(1).Interior.ColorIndex = 3
    Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$C$2=1"
    Selection.FormatConditions(2).Interior.ColorIndex = 6
End Sub

PPS. Also try here! http://rhdatasolutions.com/ConditionalFormatVBA/
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,443
Members
448,898
Latest member
drewmorgan128

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top