Color items in Combobox in UserForm

Peltz

Board Regular
Joined
Aug 30, 2011
Messages
87
Hello there.

I have a userform with a combobox where I'd like to add background color to the lists items in the drop down menu. In the sheet I where the tems are picked from, I used conditional formatting to change the fill color of the different cells, and would like the code to pick this cell color. Alternatively using VBA to select colors of the items.

I have looked around and not found a good solution to this problem using vanilla Excel.

Here is the code so far.
VBA Code:
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("FACTtavle")
Dim I As Integer
Me.ComboBox1.Clear
Me.ComboBox1.AddItem ""


For I = 3 To sh.Range("B" & Application.Rows.Count).End(xlUp).Row
      Me.ComboBox1.AddItem sh.Range("B" & I).Value 'and add cell color
    Next I
End Sub

Any help would be much appreciated.

Thanks!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
If you want to change the backcolor of the combobox itself, that I know can be done, all items having a single colour

But as far as I know, you can't change the "backcolor" of the individual items of a Combobox, not with the regular combobox control that we have in VBA, except some custom controls as I have seen in some article/YouTube video
 
Upvote 0
Ok, thanks. Might just add a suffix on the list items to make them stand out.
 
Upvote 0

Forum statistics

Threads
1,215,694
Messages
6,126,252
Members
449,305
Latest member
Dalyb2

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