Populate userform combobox with unique values from a range

soood

Board Regular
Joined
Feb 25, 2009
Messages
81
Hi all, I have a user form with combobox19 that I need to fill with only the unique values from sheet "maintenance" C2:c500.

Thanks for any help!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi,

try

Code:
Private Sub UserForm_Initialize()

Dim v, e
With Sheets("maintenance").Range("c2:c500")
    v = .Value
End With
With CreateObject("scripting.dictionary")
    .comparemode = 1
    For Each e In v
        If Not .exists(e) Then .Add e, Nothing
    Next
    If .Count Then Me.ComboBox19.List = Application.Transpose(.keys)
End With
End Sub

HTH
 
Upvote 0
I am blown away - this was the perfect answer for what I was looking for, and notably over my head-
 
Upvote 0
This was perfect for me as well. Can someone help with some additional depth. Combo box #1 is populated with information from column A (Fruits, Vegetables, etc). I select an item from combo box #1 (such as Fruit) which then filters combo box #2 to all the values in Column B corresponding to matching value in combo box #1 (lists all fruits). Combo box #3 continues by populating with values corresponding to items that match combo box 1 (Fruit) and combo box 2 (Apple) to select the type of apple. Basically like using filters within Excel.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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