Reference Combo Box to Column of Data

B

Benjamin

Question: How do I reference a list of data from a column in a combo box

I have a drop down menu in a Form, I figure use a combo box
I'd like to have it reference a specific name range in a sheet or Column for
instance.
I'll have apples, pears, peaches, etc in Column B
So if a user changes column B then the combo box will reflect that change
when it's opened.
 
D

Dave Peterson

You can use the Userform_initialize event to populate the values into that
combobox.

One way is:

Option Explicit
Private Sub UserForm_Initialize()
With Worksheets("Sheet1")
Me.ComboBox1.List _
= .Range("b1", .Cells(.Rows.Count, "B").End(xlUp)).Value
End With
End Sub

But there are lots of other ways, too. They can be useful if want to format the
values in the combobox (money/time/dates) or want to skip cells that don't meet
a certain criteria.
 

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

Top