Hiliting cells a different color

gaz8000

New Member
Joined
Aug 17, 2011
Messages
9
Is there a way of hiliting cells a different color depending on value?

For instance for all columns that contain the text 'complete' and the underlying rows are N or P then color blue.

Can this be done

TIA
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Research "Conditional formatting" for this.
There will be hundreds of posts here, but you'll probably be able to work it out for yourself if you look at in within Excel.
 
Upvote 0
.............so you need to say that in your original post!
 
Upvote 0
Do you have the condition you would use to do it manually in one cell? Converting that to vba should be fairly straightforward.
 
Upvote 0
As an example the below will colour the selected cell red if it contains the word "Bob"

Were you to stick a select all for the sheet in question before it, and adapt the formula and colours it should work

Code:
    Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
        Formula1:="=""Bob"""
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 255
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).StopIfTrue = False

There is probably a more efficent way to do it than the above (grabbed by the macro recorder) using the .formatconditions method if you are willing to do a bit of digging.
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,904
Members
452,948
Latest member
Dupuhini

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