Populating combobox/listbox

  • Thread starter Torstein S. Johnsen
  • Start date
T

Torstein S. Johnsen

This topic has certainly been answered before, but I'm not able to find an
answer.

How do you populate list/comoboxes via VBA in Excel. I want to populate the
box with all the elements in a range. Is there web-site that gives good
information about userforms and listboxes in excel?

Torstein S. Johnsen
 
R

Rob van Gelder

Here's an example:

Private Sub CommandButton1_Click()
Dim rng As Range

For Each rng In Range("A1:A20")
ComboBox1.AddItem rng.Value
Next
End Sub
 
Top