non-duplicate combo box

  • Thread starter Thread starter glen.e.mettler
  • Start date Start date
G

glen.e.mettler

I have about 1000 rows of data.
There are anywhere from 3 to 5 categories among the data (it changes
weekly)
I want to set up a combo box that displays only the appropriate
categories based on the available data that the user can select to
apply a filter.

How can I do that?

Glen
 
Hi Glen

There are several ways. This one is fun because it's so awfully brutal:

Sub FillCbo()
Dim C As Collection
Dim L As Long
Set C = New Collection
On Error Resume Next
For L = 1 To 2000
If Sheets(1).Cells(L, 1).Value <> "" Then _
C.Add Sheets(1).Cells(L, 1).Value, _
Sheets(1).Cells(L, 1).Value
Next
Sheets(1).ComboBox1.Clear
For L = 1 To C.Count
Sheets(1).ComboBox1.AddItem C(L)
Next
End Sub

HTH. Best wishes Harald
 

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

Back
Top