To populate a combo box on a userform in Excel you need to use VBA. Firstly add a combo box to a userform in the VBA window (Alt-F11) of your spreadsheet.

The VBA code below shows how to populate a 2 column combo box. Add this code to the Userform Initialize event to populate the combo box when the form is loaded.

You might need to add a Reference to make the ADODB part of this work. Go to Tools – References in the VBA window and find the highest number Microsoft ActiveX Data Objects 2.X Library. Select the highest 2.X library.


Private Sub UserForm_Initialize()

On Error GoTo UserForm_Initialize_Err

Dim conn As New ADODB.Connection
Dim rst As New ADODB.Recordset

Dim i As Integer

conn.Open "Initial Catalog=database;Data Source=server;"""

rst.Open "select distinct Field1, Field2 from table order by Field1", conn, adOpenDynamic

i = 0

rst.MoveFirst

With Me.ComboboxName

.Clear
Do
.AddItem rst!Field1
.List(i, 0) = rst!Field1
.List(i, 1) = rst!Field2
i = i + 1
rst.MoveNext
Loop Until rst.EOF
End With

UserForm_Initialize_Exit:
On Error Resume Next
rst.Close
conn.Close
Set rst = Nothing
Set conn = Nothing
Exit Sub
UserForm_Initialize_Err:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical, "Error!"
Resume UserForm_Initialize_Exit

End Sub