ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   populating a multi-column Listbox (https://www.excelbanter.com/excel-programming/296339-re-populating-multi-column-listbox.html)

Tom Ogilvy

populating a multi-column Listbox
 
You have use the rowsource (userform) or listfillrange (worksheet) property
of the Combobox. Then, when you make headers true in the properties, it
uses the row above the specified range to get the header information. You
can't do it unless you bind the control to a range using one of the above.

--
Regards,
Tom Ogilvy


"Joe" wrote in message
...
Hello All,

I am using Excel 2002 and am having trouble populating a 3 column listbox

with headers. Could someone provide a sample of code that I could model
this by? The Xl help isn't that helpful with setting column headers and
populating the columns. Do I have to use a multi-dimensional array?

Thanks,

Joe




joe

populating a multi-column Listbox
 
Tom

What if I forget about the headers and want to populate a multicolumn listbox. Can I do this with VBA

I have VBA code in which I want to populate a multicolumn listbox with values that are stored in a collection; they are not located (now) in a worksheet range

Thanks

Jo

----- Tom Ogilvy wrote: ----

You have use the rowsource (userform) or listfillrange (worksheet) propert
of the Combobox. Then, when you make headers true in the properties, i
uses the row above the specified range to get the header information. Yo
can't do it unless you bind the control to a range using one of the above

--
Regards
Tom Ogilv


"Joe" wrote in messag
..
Hello All
I am using Excel 2002 and am having trouble populating a 3 column listbo

with headers. Could someone provide a sample of code that I could mode
this by? The Xl help isn't that helpful with setting column headers an
populating the columns. Do I have to use a multi-dimensional array
Thanks
Jo





Bob Phillips[_6_]

populating a multi-column Listbox
 
Joe,

Here is one way to load it. I have done it from an array, but you should be
able to adapt to your collection

Dim ary, i, j

ary = [{"Bob","M", 123;"Lynne","F",898;"Amy","F",543}]

With ListBox1
For i = 1 To 3
.AddItem ary(i, 1)
For j = 2 To 3
.List(.ListCount - 1, j - 1) = ary(i, j)
Next j
Next i
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Joe" wrote in message
...
Tom,

What if I forget about the headers and want to populate a multicolumn

listbox. Can I do this with VBA?

I have VBA code in which I want to populate a multicolumn listbox with

values that are stored in a collection; they are not located (now) in a
worksheet range.

Thanks,

Joe

----- Tom Ogilvy wrote: -----

You have use the rowsource (userform) or listfillrange (worksheet)

property
of the Combobox. Then, when you make headers true in the properties,

it
uses the row above the specified range to get the header information.

You
can't do it unless you bind the control to a range using one of the

above.

--
Regards,
Tom Ogilvy


"Joe" wrote in message
...
Hello All,
I am using Excel 2002 and am having trouble populating a 3 column

listbox
with headers. Could someone provide a sample of code that I could

model
this by? The Xl help isn't that helpful with setting column headers

and
populating the columns. Do I have to use a multi-dimensional array?
Thanks,
Joe







joe

populating a multi-column Listbox
 
Thank

----- Bob Phillips wrote: ----

Joe

Here is one way to load it. I have done it from an array, but you should b
able to adapt to your collectio

Dim ary, i,

ary = [{"Bob","M", 123;"Lynne","F",898;"Amy","F",543}

With ListBox
For i = 1 To
.AddItem ary(i, 1
For j = 2 To
.List(.ListCount - 1, j - 1) = ary(i, j
Next
Next
End Wit


--

HT

Bob Phillip
... looking out across Poole Harbour to the Purbeck
(remove nothere from the email address if mailing direct

"Joe" wrote in messag
..
Tom
What if I forget about the headers and want to populate a multicolum

listbox. Can I do this with VBA
I have VBA code in which I want to populate a multicolumn listbox wit

values that are stored in a collection; they are not located (now) in
worksheet range
Thanks
Jo
----- Tom Ogilvy wrote: ----
You have use the rowsource (userform) or listfillrange (worksheet

propert
of the Combobox. Then, when you make headers true in the properties

i
uses the row above the specified range to get the header information

Yo
can't do it unless you bind the control to a range using one of th

above
--

Regards
Tom Ogilv
"Joe" wrote in messag

..
Hello All
I am using Excel 2002 and am having trouble populating a 3 colum

listbo
with headers. Could someone provide a sample of code that I coul

mode
this by? The Xl help isn't that helpful with setting column header

an
populating the columns. Do I have to use a multi-dimensional array
Thanks
Jo



All times are GMT +1. The time now is 06:25 PM.

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