Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #2   Report Post  
Posted to microsoft.public.excel.programming
joe joe is offline
external usenet poster
 
Posts: 62
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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






  #4   Report Post  
Posted to microsoft.public.excel.programming
joe joe is offline
external usenet poster
 
Posts: 62
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populating listbox Mick[_2_] Excel Discussion (Misc queries) 1 May 14th 08 10:48 PM
populating a multi-column Listbox Harald Staff Excel Programming 1 April 26th 04 08:26 PM
Populating a userform 3 col listbox Martin[_13_] Excel Programming 0 April 19th 04 09:49 PM
Multi-column ListBox. Multiple bound columns??? Joe Mathis Excel Programming 5 December 10th 03 02:32 AM
Date formatting in a multi column listbox Nigel Brown[_2_] Excel Programming 2 September 3rd 03 11:29 AM


All times are GMT +1. The time now is 04:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"