Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
another way would be to populate the combo in the form's initialise event
using a scripting runtime dictionary to filter out duplicates.... '''set a reference to MS Scripting runtime... Private Sub UserForm_Initialize() Dim dic As New Scripting.Dictionary Dim rSource As Range, cell As Range Dim sVal As String ' point to your column Set rSource = Range("MyList") With ComboBox1 For Each cell In rSource.Cells sVal = cell.Value If Not dic.Exists(sVal) Then dic.Add sVal, sVal .AddItem sVal End If Next End With Set dic = Nothing End Sub if the item is in the dictionary, we have it so skip on to the next item. If an item isn't in the dictionary, then add it to the dictionary and to the combobox. The dictionary object is extremely useful, Its effectively a collection, but unlike a collection, with a dictianry you can test teh existence of a key...you can also extract the keys and loop through them. -- Patrick Molloy Microsoft Excel MVP --------------------------------- I Feel Great! --------------------------------- "ajliaks " wrote in message ... Hi! I have userform called "Exporting", which includes combobox called "ChapExpCB" Now ChapExpCB shows me a list of items included in a selected column. Some of the items are repetead, and I need to Show each one just once. Exacly like autofilter does. How can I do? Thanks. --- Message posted from http://www.ExcelForum.com/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ComboBox Question | Excel Discussion (Misc queries) | |||
another combobox question | Excel Discussion (Misc queries) | |||
ComboBox Question | Excel Worksheet Functions | |||
ComboBox populated with data from AutoFilter | Excel Programming | |||
ComboBox Question | Excel Programming |