Conditional Formatting (more than 3)

billyboyuk2000

Board Regular
Joined
Apr 29, 2005
Messages
52
Been a while since i have been in here......hello all.

Can anyone help me out with this one?

I want cells to turn certain colours when you type in a code i.e.

1 cell could have upto 6 codes in it and I would like each code to turn the cell a different colour.

Is this possible?
 

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.

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
Hello,

THis will change any cell in the sheet when you enter the relevant word.

The code needs to go into the relevant sheet code window

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Select Case Target.Value
        Case "A"
            Target.Interior.ColorIndex = 3
        Case "B"
            Target.Interior.ColorIndex = 31
    End Select
    
End Sub

Change refs as required, you will need to add the other 4 conditions.

If you need it for a specific range, post back with the range.
 

fireslguk

Active Member
Joined
Nov 11, 2005
Messages
286
like it how about if

a1:a20 = "Y" but b1:b20 changes the colour which would contain text
 

billyboyuk2000

Board Regular
Joined
Apr 29, 2005
Messages
52
Formatting + VBA follow on

Right the VBA code works a treat..thanks for that.

Instead of keying in "SB" = colour on the VBA code could it be linked to cell references so you opnly have to change the "SB" to a "BA" and it'll still change colour?

Hope that makes sense?
 

Forum statistics

Threads
1,136,307
Messages
5,674,986
Members
419,541
Latest member
freddyboots

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