ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   combobox with columns (https://www.excelbanter.com/excel-programming/323213-combobox-columns.html)

JT[_2_]

combobox with columns
 
I have a combo box on my form with 12 columns. The items
are added down in the first column when I use the
following code:

combobox1.add item var1
combobox1.add item var2
combobox1.add item var3
combobox1.add item var4

I would like to add them across in Col 1, Col 2, Col 3 and
Col 4.

I haven't used combo boxes before and am struggling with
this one.

Thanks for the help



galimi[_2_]

combobox with columns
 
If you build an array and then assign it to the combobox list property, it
should populate the columns, e.g.,

lbItem (1,1) = "Name" 'Row 1, Column 1
lbItem (1,2) = "Company" 'Row 1, Column 2
lbItem (2,1) = "Bill" 'Row 2, Column 1
lbItem (2,2) = "MS" 'Row 2, Column 2
combobox1.list = lbitem()

http://HelpExcel.com

"JT" wrote:

I have a combo box on my form with 12 columns. The items
are added down in the first column when I use the
following code:

combobox1.add item var1
combobox1.add item var2
combobox1.add item var3
combobox1.add item var4

I would like to add them across in Col 1, Col 2, Col 3 and
Col 4.

I haven't used combo boxes before and am struggling with
this one.

Thanks for the help




Tom Ogilvy

combobox with columns
 
if its a range

combobox1.List = worksheets("Sheet1") _
.Range("A2").Resize(20,12).Value

--
Regards,
Tom Ogilvy


"JT" wrote in message
...
I have a combo box on my form with 12 columns. The items
are added down in the first column when I use the
following code:

combobox1.add item var1
combobox1.add item var2
combobox1.add item var3
combobox1.add item var4

I would like to add them across in Col 1, Col 2, Col 3 and
Col 4.

I haven't used combo boxes before and am struggling with
this one.

Thanks for the help






All times are GMT +1. The time now is 12:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com