Populate form combo with unique values

P

Piers 2k

Hi folks,

Simple list spreadsheet, column headings, etc... Have a combo on a form I'd
like to populate with unique values from a column in the range.
Current code works fine (obviously selecting cells first), but no way to
only show unique values? Any idea how can I eliminate them?

' start of code
Dim item As Range

For Each item In Selection
cmbDept.AddItem item
Next
' end of code

Any ideas?

TIA,
Piers
 
B

bigwheel

Well, you could build the Advanced Filter into your code which does allow you
to see unique values then those values would be used to populate your combo

Range(whatever).AdvancedFilter Action:=xlFilterInPlace, Unique:=True
 

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

Top