ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populating combobox/listbox (https://www.excelbanter.com/excel-programming/298140-populating-combobox-listbox.html)

Torstein S. Johnsen[_2_]

Populating combobox/listbox
 
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



Rob van Gelder[_4_]

Populating combobox/listbox
 
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


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Torstein S. Johnsen" wrote in message
...
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






All times are GMT +1. The time now is 02:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com