Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 5
Default Adding color to drop down box

I have a spreadsheet where I keep track of the skill level of employees.
They can select from None, Beginner, Intermediate, Advanced and Expert. I
would like the text color to be different for each selection so that when I
look at the results if i am trying to find all those that have indicated
expert for a particular product I just need to look for the color.

i tried using conditional formatting but it only gives you 3 conditions and
when I tried to copy it for each person, the formula would. Hen even when I
tried changing another column manually it kept changing back to the original
formula I setup.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 22,906
Default Adding color to drop down box

Right-click on the sheet tab and "View Code"

Copy/paste the code below into that module.

Edit the range to suit.

Alt + q to return to Excel.


Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<=== change to suit

check_words = Array("advanced", "expert", "beginner", _
"none", "intermediate")
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
For i = LBound(check_words) To UBound(check_words)
If InStr(1, .Value, check_words(i)) Then
Select Case i + 1
Case 1: .Interior.ColorIndex = 3 'red
Case 2: .Interior.ColorIndex = 6 'yellow
Case 3: .Interior.ColorIndex = 5 'blue
Case 4: .Interior.ColorIndex = 10 'green
Case 5: .Interior.ColorIndex = 17 'periwinkle
End Select
End If
Next i
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP


On Wed, 1 Jul 2009 11:30:02 -0700, Devo
wrote:

I have a spreadsheet where I keep track of the skill level of employees.
They can select from None, Beginner, Intermediate, Advanced and Expert. I
would like the text color to be different for each selection so that when I
look at the results if i am trying to find all those that have indicated
expert for a particular product I just need to look for the color.

i tried using conditional formatting but it only gives you 3 conditions and
when I tried to copy it for each person, the formula would. Hen even when I
tried changing another column manually it kept changing back to the original
formula I setup.

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 5
Default Adding color to drop down box

Thanks, it worked great.

Two other questions I thought you may be able to answer.

Where do you find the color index numbers? I have tried searching for it
and couldn't find anything.

Also, is there a way to change the code so that you change the color of the
text rather than of the cell?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding to drop down lists Petren Excel Discussion (Misc queries) 1 July 8th 08 02:08 PM
color fill button is not adding color to my spread sheet mitchnmd Excel Worksheet Functions 1 September 26th 07 04:36 PM
Adding a Drop-Down Calendar Paul H H Excel Discussion (Misc queries) 2 December 27th 06 10:36 PM
Adding value to drop down list neb Excel Discussion (Misc queries) 3 June 24th 05 01:40 PM
Adding By Color GR Excel Worksheet Functions 3 June 7th 05 09:00 PM


All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"