Originally Posted by
rodneykaye
Can a code be supplied where i have a group of dropdown lists of colours.When a coloir is selected in any or all these cells it colours the cell whatever colour is selected.If i select Blue from the list then it colours the cell Blue
You can use the following event code to do that. One thing to point out to you, though... your drop down list has a blank space following the "E" in "BLUE" which is why my code below has a blank space following the "E" in "BLUE" as well. If you choose to correct your list by removing that space character, then remember to do that in the code below as well.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("C3,E3,G3,I3,C9,E9,G9,I9,C15,E15,G15,I15")) Is Nothing Then
Select Case Target.Value
Case "RED": Target.Interior.ColorIndex = 3
Case "BLUE ": Target.Interior.ColorIndex = 5
Case "GREEN": Target.Interior.ColorIndex = 4
Case "YELLOW": Target.Interior.ColorIndex = 6
Case "WHITE": Target.Interior.ColorIndex = 2
End Select
End If
End Sub
HOW TO INSTALL Event Code
------------------------------------
If you are new to event code procedures, they are easy to install. To install it, right-click the name tab at the bottom of the worksheet that is to have the functionality to be provided by the event code and select "View Code" from the popup menu that appears. This will open up the code window for that worksheet. Copy/Paste the event code into that code window. That's it... the code will now operate automatically when its particular event procedure is raised by an action you take on the worksheet itself.
Bookmarks