Conditional Formatting - need more options for colour changi

chrisaustralia

New Member
Joined
Oct 3, 2006
Messages
38
hi, i know in conditional formatting, it only allows 3 values for changing the cell colour..I need to be able to put in 6 conditions for colours. If there a formula to do this? Thanks.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

chrisaustralia

New Member
Joined
Oct 3, 2006
Messages
38
Ok, well i have 6 sets of conditions. 1. GI = Green, 2. INV = Blue, 3. Super =Yellow 4. Life =Purple, 5 Wrap = Red, 6: Corporate=Light blue.
In conditional formatting, it only allows the first 3 sets to change colours if the cell equals one of those conditions. Make sense?!

Thanks!!
 

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
Welcome to the Board!

What specific range do your conditions apply to?

Smitty
 

chrisaustralia

New Member
Joined
Oct 3, 2006
Messages
38

ADVERTISEMENT

Just to one column. F3, to F135

Thanks.
 

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
This ougt to do it:

<font face=Tahoma><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Worksheet_Change(<SPAN style="color:#00007F">ByVal</SPAN> Target <SPAN style="color:#00007F">As</SPAN> Range)
    <SPAN style="color:#007F00">'   Multiple Conditional Format</SPAN>
    <SPAN style="color:#00007F">Dim</SPAN> rng <SPAN style="color:#00007F">As</SPAN> Range
     <SPAN style="color:#007F00">'   Only look at single cell changes</SPAN>
    <SPAN style="color:#00007F">If</SPAN> Target.Count > 1 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
    <SPAN style="color:#007F00">'   Adjust Format range to suit</SPAN>
    <SPAN style="color:#00007F">Set</SPAN> rng = Range("F3:F135")
    <SPAN style="color:#007F00">'   Only look at that range</SPAN>
    <SPAN style="color:#00007F">If</SPAN> Intersect(Target, rng) <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
        <SPAN style="color:#007F00">'   Adjust conditions to suit</SPAN>
        <SPAN style="color:#00007F">Select</SPAN> <SPAN style="color:#00007F">Case</SPAN> Target.Value
            <SPAN style="color:#00007F">Case</SPAN> "GI"
                Target.Interior.ColorIndex = 50  <SPAN style="color:#007F00">'   Green</SPAN>
            <SPAN style="color:#00007F">Case</SPAN> "INV"
                Target.Interior.ColorIndex = 3     <SPAN style="color:#007F00">'   Blue</SPAN>
            <SPAN style="color:#00007F">Case</SPAN> "Super"
                Target.Interior.ColorIndex = 6   <SPAN style="color:#007F00">'   Yellow</SPAN>
            <SPAN style="color:#00007F">Case</SPAN> "Life"
                Target.Interior.ColorIndex = 13   <SPAN style="color:#007F00">'   Purple-ish</SPAN>
            <SPAN style="color:#00007F">Case</SPAN> "Wrap"
                Target.Interior.ColorIndex = 5    <SPAN style="color:#007F00">'   Red</SPAN>
            <SPAN style="color:#00007F">Case</SPAN> "Corporate"
                Target.Interior.ColorIndex = 37   <SPAN style="color:#007F00">'   Light Blue</SPAN>
        <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Select</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>

Smitty
 

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
Where do you get the Color Index numbers from?

<font face=Tahoma><SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Sub</SPAN> GetColors()
    <SPAN style="color:#00007F">Dim</SPAN> x <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>
    <SPAN style="color:#007F00">'   Add Colors and their related Indices to a blank sheet</SPAN>
    Application.ScreenUpdating = <SPAN style="color:#00007F">False</SPAN>
        <SPAN style="color:#00007F">For</SPAN> x = 1 <SPAN style="color:#00007F">To</SPAN> 56
            Cells(x, 1) = x
            Cells(x, 2).Interior.ColorIndex = x
        <SPAN style="color:#00007F">Next</SPAN> x
    Application.ScreenUpdating = <SPAN style="color:#00007F">True</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

Or you can simply record applying different colors to a cell.

HTH,

Smitty
 

Forum statistics

Threads
1,136,430
Messages
5,675,803
Members
419,586
Latest member
RoteichA

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
Top