-
This will give you a unique list to populate a combobox. As posted here. The SpecialCells bit works with a filtered list, so you can remove it if not required.
[VBA]
Private Sub UserForm_Initialize()
ListBox1.List = ListData("A")
End Sub
Function ListData(col)
Dim d
Set d = CreateObject("Scripting.Dictionary")
Dim Rng As Range, cel As Range
Set Rng = Range(Cells(2, col), Cells(Rows.Count, col).End(xlUp)).SpecialCells(xlCellTypeVisible)
On Error Resume Next
For Each cel In Rng
d.Add cel.Value, CStr(cel)
Next
On Error GoTo 0
ListData = d.items
End Function
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules