Combo box background colour

G

Guest

I have a combo box and it is linked to a cell a2.
When I select a value from the combo box drop down list this obviously
changes the value in cell A2. Is it possible to have the background of the
como box automatically change colour depending on the value of cell a2?
e.g. Cell A2 = 1, combo box background = red
Cell A2 = 2, combo box background = green
Cell A2 = 3, combo box background = blue
Thanks for any help
 
M

Mike Fogleman

Try this in the combobox_change event code:

Private Sub ComboBox1_Change()
If Range("A2").Value = 1 Then Me.ComboBox1.BackColor = RGB(255, 0, 0)
If Range("A2").Value = 2 Then Me.ComboBox1.BackColor = RGB(0, 255, 0)
If Range("A2").Value = 3 Then Me.ComboBox1.BackColor = RGB(0, 0, 255)
End Sub

Mike F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top