Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Liz Liz is offline
external usenet poster
 
Posts: 133
Default How do I add fill colour to drop down boxes?

I have created drop down boxes in Excel using the validation tool but I need
each option to have a different fill colour. How do I do this?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default How do I add fill colour to drop down boxes?

One way:

This code changes the background depending on the value in your DV cell: in
the example it is cell C1

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "C1:C1" '<=== change to your DV cell


On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Select Case .Value '<== need to change test to reflect you DV
values
Case 1: .Interior.ColorIndex = 3 'red
Case 2: .Interior.ColorIndex = 6 'yellow
Case 3: .Interior.ColorIndex = 5 'blue
Case 4: .Interior.ColorIndex = 10 'green
'etc.
End Select
End With
End If


ws_exit:
Application.EnableEvents = True
End Sub

To use code: right-click on w/sheet tab, "View code" and copy/paste above code

HTH

"Liz" wrote:

I have created drop down boxes in Excel using the validation tool but I need
each option to have a different fill colour. How do I do this?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default How do I add fill colour to drop down boxes?

On Jun 14, 12:41 pm, Liz wrote:
I have created drop down boxes in Excel using the validation tool but I need
each option to have a different fill colour. How do I do this?



You can use conditional formatting so long as your list is not more
than 3

In the conditional formatting dialogue box select formula is: and
enter the following formula
=A1 = "Option 1" then format

Assuming your list starts at A1. Make sure you put the options in
"quotations"

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 611
Default How do I add fill colour to drop down boxes?

Liz,

I'm pretty sure you can't do that. The only thing that comes to mind is to make your own
userform, with which you need to write macros to handle everything. A button on the
worksheet, similar to the dropdown button, would initiate your userform. It wouldn't appear
directly below the cell without some coaxing, though.

--
Earl Kiosterud
www.smokeylake.com

Note: Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
-----------------------------------------------------------------------
"Liz" wrote in message
...
I have created drop down boxes in Excel using the validation tool but I need
each option to have a different fill colour. How do I do this?



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
colour description boxes KateB Excel Discussion (Misc queries) 5 February 27th 07 02:36 PM
can the fill colour of a bar be tied to the data font colour data PaulC Charts and Charting in Excel 0 June 23rd 06 01:21 AM
Fill Colour Blackcat Excel Discussion (Misc queries) 3 October 13th 05 06:43 PM
How to fill colour in Excel, it appers No fill in my computer? bede Excel Discussion (Misc queries) 1 June 11th 05 03:27 AM
Sum by Fill colour Steve Wood Excel Worksheet Functions 3 December 21st 04 04:50 PM


All times are GMT +1. The time now is 12:22 AM.

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

About Us

"It's about Microsoft Excel"