Combobox List does not include duplicates & other

MFish

Board Regular
Joined
May 9, 2019
Messages
76
Hi, is it possible for the combobox.list to not show duplicates? Here's the code I have...

Code:
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False

With Worksheets("Input new run")
   Me.cmbDelLH.List = .Range("B7", .Range("B7").End(xlDown)).Value
   Me.cmbLegDel.List = .Range("c7", .Range("C7").End(xlDown)).Value
   
End With

End Sub

In column "B" I will have a lot of duplicates. Is there a way for the list to only be the "What's new" and not duplicated items? Example:

Column B Column C
[TABLE="width: 500"]
<tbody>[TR]
[TD]A
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]3
[/TD]
[/TR]
</tbody>[/TABLE]

Basically in the first combobox it will only show two items to choose from... A and B.

Now, is it possible to only show the list in combobox2 off of what was chosen in combobox1? In this case if I were to select selection "A", in combobox1, then in combobox2 it will only show the values of "1, 2" and leaving out 3 because the first combobox is selected on A, respective to the data above, offset(0,1)?
 
Hey Fluff,

So I input the code in and the first combobox1, named cmbDelLh will have the correct information when the drop down is selected, yet once I try to hit a selection it comes back as a runtime error of: 91 and highlights...
Not quite sure why you would get that error, do you want to pursue this, or are you happy to run with Dante's code?
 
Last edited:
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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