View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
jindon[_35_] jindon[_35_] is offline
external usenet poster
 
Posts: 1
Default Populate a Combobox from range.


try

Code
-------------------

Private Sub UserForm_Initialize()
Dim dic As Object, x, r As Range
Set dic = CreateObject("Scripting.Dictionary")
With Sheets("sheet1")
For Each r In .Range("a2:a4")
If Not IsEmpty(r) And Not dic.exists(r.Value) Then
dic.Add r.Value, Nothing
End If
Next
End With
x = dic.keys
Me.ComboBox1.List() = x
Set dic = Nothing: Erase x
End Sub

-------------------

--
jindo
-----------------------------------------------------------------------
jindon's Profile: http://www.excelforum.com/member.php...fo&userid=1313
View this thread: http://www.excelforum.com/showthread.php?threadid=38930