Populating data in ComboBoxes on UserForms

  • Thread starter Thread starter martin.a.john
  • Start date Start date
M

martin.a.john

Hi

I am trying to create a User from that has a drop-down for the user to
select from a pre-defined list.

I have created a combobox on the user form and have no idea how to
populate my list into this when the form opens for the user.

Is there is something really basic I am missing here? I have tried
playing around with ComboBox.AddItem "xxx" for example.
The combo box is still blank when I open the user form:(

Martin
 
You've got it but I think your timing is off. Where are you adding items.
Typically you activate the userform with userform1.show somewhere like in the
workbook open event, well before you show it, add all of your items.
 
Excellent, thanks dude :)


You've got it but I think your timing is off. Where are you adding items.
Typically you activate the userform with userform1.show somewhere like in the
workbook open event, well before you show it, add all of your items.
 
There are two ways to populate the combobox. If it is a single column and
your data source is located in a single row or single column on the
worksheet, you can use the row source in the combobox properties by entering
the cell range reference, exmp: a10:a20.

If you want to use the AddItem method. Put it in the UserForm_Initialize
code module. When you then execute the command UserForm1.Show, the
Initialize code executes first and loads the combo box.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top