Changing Font Color in drop down list

DailyDrama

New Member
Joined
Nov 26, 2019
Messages
2
Office Version
  1. 2013
Platform
  1. Windows
Hi, i have a drop down list that i want to change the font color of based on the selection. Two out of three of my selections/Font color change work - but i cannot get "Amber" to work. I have "white" as the font colour - it works, but when i change the color to Amber or Orange - it doesnt work. What am i doing wrong??

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
With ContentControl.Range
If ContentControl.Title = "Status" Then
Select Case .Text
Case "GREEN - controls green or <=2 controls amber"
.Font.ColorIndex = wdGreen
.Cells(1).Shading.BackgroundPatternColor = wdColorGreen
Case "AMBER - >2 controls amber - up to 6, No more than 1 control red"
.Font.ColorIndex = wdWhite
.Cells(1).Shading.BackgroundPatternColor = wdColorOrange
Case "RED - >1 control Red"
.Font.ColorIndex = wdRed
.Cells(1).Shading.BackgroundPatternColor = wdColorRed
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
if you try:

Code:
.Font.ColorIndex = wdAmber
it can't works.

Check pallet of excel colours here
 
Upvote 0
Hi Kokosek,
thanks but i have used "amber" as the font colour in the code - it justs displays as black (automatic). I am just using "white" as a second option.
- from what i am reading - only colours 1-8 can be used?? Orange (46) or light orange (45) dont seem to work in the code as a number or as RGB (X,X,X) - the code debugger comes up.
 
Upvote 0
If you use it like:

Code:
.Font.ColorIndex = RGB(255,102,0)
it gives error but:
Code:
.Font.Color = RGB(255,102,0)
should works.

Not tested.
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,138
Members
453,021
Latest member
Justyna P

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