Userform list box population

  • Thread starter Thread starter Alberto Ast
  • Start date Start date
A

Alberto Ast

I need to have a field in a user form to select from a list of options...
I guess I use listbox but I do not know how does it works... ho do I
populate the lsit so it will show in the form?

I already place the question about two hours ago but it does not show in the
forum so I guess it got lost in limbo.

Help is appreciated.
 
Hi,

I think you may need a combobox and one way of populating it is like this

Private Sub UserForm_Initialize()
For x = 1 To 10
ComboBox1.AddItem Sheets("Sheet3").Cells(x, 1).Value
Next
End Sub


Mike
 
It worked great, thanks... but do I have to put the data in a row..? how do I
do it in a column?
 
'For range A1:J1
Private Sub UserForm_Initialize()
For x = 1 To 10
ComboBox1.AddItem Sheets("Sheet3").Cells(1, x).Value
Next
End Sub

OR

Dim cell as Range
For each cell in Sheets("Sheet3").Range("A1:J1")
ComboBox1.AddItem cell.Text
Next



If this post helps click Yes
 
Back
Top