Combo Box - Unique Entry - Problem

stucamps

Board Regular
Joined
Jul 3, 2003
Messages
114
I have a combo Box in VBA which with the code below omits any multiple entries:
Code:
Private Sub cboManagerName_DropButtonClick()

Dim rng As Range
Dim collNoDupes As New Collection
Dim lng As Long
Dim Item
Dim rngfield As Range
Set rngfield = ThisWorkbook.Sheets("Database").Range("C1:C400")

cboManagerName.Clear
On Error Resume Next
For Each rng In rngfield
    collNoDupes.Add rng.Value, CStr(rng.Value)
Next rng
On Error GoTo 0

For Each Item In collNoDupes
    cboManagerName.AddItem Item
Next Item


cmdManager.Enabled = True

End Sub

The problem is when I select the entry I want the Combo Box displays a blank - it doesnt capture the selection I want.
Where am I going wrong???????

Thanks
Stuart
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Try Naming the Range "C1:C400" to say "MyCombo" and then instead of the Range("C1:C400") try Range("MyCombo") and see if that works.
 
Upvote 0

Forum statistics

Threads
1,203,187
Messages
6,053,992
Members
444,696
Latest member
VASUCH

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