Combobox in userform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Just help ao I con start on this
How do i get data from a sheet in to the combobox
combobox is on userform

Alvin
 
Hi Alvin

something along the lines of
Private Sub UserForm_Initialize()
Dim myrange As Range

Set myrange = Sheets("Sheet4").Range("A1:A10")

For Each c In myrange
ComboBox1.AddItem c.Value
Next
End Sub

Hope this helps
Cheers
JulieD
 
Name your array in the sheet then set your 'Rowsource' property available in
the combobox properties screen e.g. "=listname"
 
Hi Alvin

thanks for the feedback ..."Newbie's" suggestion is an alternative method
you might consider - but i've never done it that way so i'm not sure of the
Pros and Cons

Cheers
JulieD
 
Hi Julie

That's the old discussion of databound vs unbound controls, a question of
personal style and strong beliefs <g>. I always use your way of doing
things, "unnecessary" code instead of databinding properties.

Best wishes Harald
 
Another way would be

Private Sub UserForm_Initialize()
ComboBox1.List = Sheets("Sheet4"). _
Range("A1:A10").Value
End Sub
 

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