How to populate a combobox from a column
dalibma
Posted messages
38
Registration date
Status
Member
Last intervention
-
eriiic Posted messages 24581 Registration date Status Contributor Last intervention -
eriiic Posted messages 24581 Registration date Status Contributor Last intervention -
Hello,
I have column A filled from A1 to A1000 on Sheet2.
On Sheet1, I created a button that displays a userform which has a combobox (type of editable list box).
This combobox should contain the data from column A; I ran this code for the combobox:
Private Sub UserForm1_Initialize()
ComboBox1.List = Worksheets("Sheet2").Range("A2:A20").Value
End Sub
The problem: I cannot find the data in the combobox.
Thank you for your help.
I have column A filled from A1 to A1000 on Sheet2.
On Sheet1, I created a button that displays a userform which has a combobox (type of editable list box).
This combobox should contain the data from column A; I ran this code for the combobox:
Private Sub UserForm1_Initialize()
ComboBox1.List = Worksheets("Sheet2").Range("A2:A20").Value
End Sub
The problem: I cannot find the data in the combobox.
Thank you for your help.
5 answers
Hello,
The syntax is correct. You would need to put your line of code in a Sub that you call.
And to initialize it on opening, place it in Private Sub Workbook_Open()
Otherwise, please upload the xls file (reduced to the necessary and anonymized) on cjoint.com and paste the provided link here.
eric
By trying continuously, we eventually succeed.
So the more it fails, the more chances we have that it will work. (Shadok motto)
In addition to the thanks (yes, it’s done!!!), remember to mark it as resolved. Thank you.
The syntax is correct. You would need to put your line of code in a Sub that you call.
And to initialize it on opening, place it in Private Sub Workbook_Open()
Otherwise, please upload the xls file (reduced to the necessary and anonymized) on cjoint.com and paste the provided link here.
eric
By trying continuously, we eventually succeed.
So the more it fails, the more chances we have that it will work. (Shadok motto)
In addition to the thanks (yes, it’s done!!!), remember to mark it as resolved. Thank you.
https://www.cjoint.com/?DCFrdRDN4UN