![]() |
Userform list box population
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. |
Userform list box population
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 "Alberto Ast" wrote: 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. |
Userform list box population
It worked great, thanks... but do I have to put the data in a row..? how do I
do it in a column? "Mike H" wrote: 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 "Alberto Ast" wrote: 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. |
Userform list box population
'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 --------------- Jacob Skaria "Alberto Ast" wrote: It worked great, thanks... but do I have to put the data in a row..? how do I do it in a column? "Mike H" wrote: 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 "Alberto Ast" wrote: 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. |
All times are GMT +1. The time now is 08:38 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com