Colour Drop down list

brayleyboy

Board Regular
Joined
Nov 24, 2005
Messages
52
Is it possible to create a dropdown list in a cell(s) whereby you can select a colour to fill the cell? I have Ecel 97 RS-2 and have been trying to do this for ages!
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Its for filling in project status on a gantt chart style table. It is purely to make it simpler for the user and reduce human error by being able to select it in the cell. Is there any way of doing this. Conditional formatting would enable a choice of three colours, but i need 5.
 
Upvote 0
Make a list of coulours like this:

Red
Green
Blue
Yellow
Brown

and name it List using Insert|Name|Define.

Select the cells you want to colour and choose Data|Validation from the menu. In the Allow box choose List. In the Source box type:

=List

and click OK.

Right click the sheet tab and choose View Code. Paste this code into the window on the right:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    MsgBox "Hello"
    Dim Temp As String
    On Error Resume Next
    Temp = Target.Validation.Formula1
    If Err <> 0 Then Exit Sub
    Select Case Target.Value
        Case "Red"
            Target.Interior.ColorIndex = 3
            Target.Font.ColorIndex = 3
        Case "Green"
            Target.Interior.ColorIndex = 10
            Target.Font.ColorIndex = 10
        Case "Blue"
            Target.Interior.ColorIndex = 5
            Target.Font.ColorIndex = 5
        Case "Yellow"
            Target.Interior.ColorIndex = 6
            Target.Font.ColorIndex = 6
        Case "Brown"
            Target.Interior.ColorIndex = 53
            Target.Font.ColorIndex = 53
    End Select
End Sub

Press Alt+F11 to return to your worksheet and try it out.
 
Upvote 0
This does not seem to work. When you select an option from the dropdown list nothing happens except it enters the word "red" etc in a black font. If you type the words "red" etc in rather than using the dropdown it brings up a nice box that says "hello", however the formatting is not changed.
 
Upvote 0
brayleyboy

Like I said in your other post, as far as I know, a selection from a validation dropdown won't trigger a worksheet change event in earlier versions of Excel.
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,016
Members
448,936
Latest member
almerpogi

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