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

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.
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.
 
Upvote 0
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?
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,246
Members
449,075
Latest member
staticfluids

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