Not enough conditional formats

xyzabc198

Board Regular
Joined
Jul 30, 2008
Messages
126
I recently tried to create conditional formatting for the following

If cell = CB turn Yellow Black text bold and itallic
If cell = S/Lit turn Bright Green Black text bold and itallic
If cell = NI turn Gray 40% Black text bold and itallic
If cell = email turn Aqua Black text bold and itallic
If cell = MR turn Lime Black text bold and itallic
If cell = Cleansed turn Rose Black text bold and itallic
If cell = Dup turn Tan Black text bold and itallic
If cell = DNC turn Red Black text bold and itallic
If cell = KW turn Light Orange Black text bold and itallic
If cell = Lead turn Lavander Black text bold and itallic
If cell = LTC turn Plum with white text Bold & Itallic
If cell = Appt turn Pink Black text bold and itallic
If cell = Quote turn Light Blue white text Bold & Itallic
If cell = XAPPT turn Sea Green Black text bold and itallic
If cell = XC turn Dark Yellow Black text bold and itallic

Obviously there is only 3 conditionals available, not 15...
Any other way to do this? maybe a macro? thanks!
 
did you include the words "code" at the top and the bottom?

because you shouldnt

this is all you should have in the module:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Value
Case "CB"
With Target
.Font.Bold = True
.Font.Italic = True
.Font.ColorIndex = 1
.Interior.Color = vbYellow
End With
Case "S/Lit"
With Target
.Font.Bold = True
.Font.Italic = True
.Font.ColorIndex = 1
.Interior.Color = vbGreen
End With
End Select
End Sub
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Doh! Can't believe I missed that. Here I am straining to point out to OP to post EVERYTHING in the module, And the OP was posting Everything....but My mind is trained to ignore Code Tags...LOL...
 
Upvote 0
did you include the words "code" at the top and the bottom?

because you shouldnt

this is all you should have in the module:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Value
Case "CB"
With Target
.Font.Bold = True
.Font.Italic = True
.Font.ColorIndex = 1
.Interior.Color = vbYellow
End With
Case "S/Lit"
With Target
.Font.Bold = True
.Font.Italic = True
.Font.ColorIndex = 1
.Interior.Color = vbGreen
End With
End Select
End Sub

OK, I did that, which stopped the error...but now urm...yeah, nothings happening :confused:
 
Upvote 0
type CB (in capitals) into a cell, press enter and then click on it again and it will change to yellow.

S/Lit wil go green

so go to the top of the column, and scroll down with the down arrow to change them all

it currently does all cells, not just column AD
 
Last edited:
Upvote 0
No Itallics or Bold either...is it just me being stupid and missing a tiny little thing? because I am pretty dull when it comes to Databases :P
 
Upvote 0
it DOES work. I made a workbook and had it working in 10 seconds!

you must be doing something wrong...

make a new workbook, open it and go to sheet 1.

at the bottom, where it has the tab "sheet 1", right click the words sheet 1 on the tab, and select view code.

then paste in the code there:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Value
Case "CB"
With Target
.Font.Bold = True
.Font.Italic = True
.Font.ColorIndex = 1
.Interior.Color = vbYellow
End With
Case "S/Lit"
With Target
.Font.Bold = True
.Font.Italic = True
.Font.ColorIndex = 1
.Interior.Color = vbGreen
End With
End Select
End Sub


then go back to normal excel and type CB in any cell, press enter.

then press the up arrow or click on the cell where you typed CB.

It will become yellow, italic and bold.

you can do the same for S/Lit

The macro is case sensitive, so you must write CB and not cb or S/LIT etc
 
Upvote 0
AHA, I got it to work, I can get all the others to work, my only question is how to get the Gray 40% one to work, what would be the code for that?
 
Upvote 0

Forum statistics

Threads
1,223,098
Messages
6,170,106
Members
452,302
Latest member
TaMere

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