Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Listbox problem

Robert Crandal wrote :

. My sample file shows how to do this. It uses a 2 col listbox w/Col2 as
Boundcolumn. User only sees names in the list (sorted) because Col2 width
is zero.


Thanks so much for the demo. It is much appreciated.

In looking at your code, it appears that you are populating the multi-column
listbox with the following code:

Me.ListBox1.list = vItemList

Is "vItemList" a "Worksheet" type of variable that corrosponds to data
on the worksheet? (I'm still kinda newbie with VBA, so I just wanted
to verify)


No. It's a VBA variant variable that I used to dump the original wks
list into. I also dumped the temp wks list into it since the original
data was no longer needed.

One thing to note about filling arrays from a wks; the 1st element is 1
not zero, AND it's a 2D array (#Rows x #Cols) even if there's only 1
col.


Also, is that the ONLY way to fill in a 2 column listbox,
by passing a Worksheet/range to the ".list" property??


No. (I didn't pass a wks range to the listbox. I passed a 2D array to
the listbox, which I populated from the temp wks) This is the quickest
(and easiest) way to read/write a range. It also happens to be the
quickest way to fill a listbox from an array. So then, there's 2
separate things happening: 1- range read/write, 2- populating a
multi-col listbox with a multi-dim array. Note, though, that the array
is dynamically sized as used here. This is preferred for unknown
amounts of data.

What if I have
data that doesn't exist on the worksheet and I want to put that data into
a 2 column, n-rows listbox?? For example, what if I have a mult-dim array
of strings....can I use this data to fill in my multi-column listbox?


Yes, in the same 'quick dump' fashion OR you can loop the array using
AddItem and the List property (specifying row/col positions). The
latter is slower by far. (Imagine a 10000 row by 20 col data table.
Would you loop or dump?)

So then, if you had such an array (10000,20) then you could set the
listbox ColumnCount to the UBound of the 2nd dim and dump the data into
it.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


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
listbox problem apndas[_9_] Excel Programming 1 July 23rd 06 03:51 PM
listbox problem #2 Keith Excel Programming 4 April 12th 05 06:32 PM
listbox problem [email protected] Excel Programming 1 March 10th 05 01:08 PM
Listbox Problem [email protected] Excel Programming 4 August 19th 04 06:47 PM
ListBox problem Mike Fogleman Excel Programming 3 December 29th 03 12:23 PM


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

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

About Us

"It's about Microsoft Excel"