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

I was looking for a faster way to get all the values in a listbox. I have
this code:

Dim vArray As Variant
dim strCSV as String

vArray = Lbox.List

strCSV = Join(vArray, ",")

but it returns a two dimentional array of (n, 9) bounds, with nulls in the
1-9 entries of every array, which can't be used in Join. The listbox has only
1 column in the properties. Is there anyway to get a one dimentional array
from a listbox? The listbox is programatically filled so it is not getting
it's source from a worksheet range. Thanks.

--
*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003

User of MS Office 2003

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default Listbox to Array

How about:

vArray = Application.Transpose(ListBox1.List)

--
Jim
"J Streger" wrote in message
...
|I was looking for a faster way to get all the values in a listbox. I have
| this code:
|
| Dim vArray As Variant
| dim strCSV as String
|
| vArray = Lbox.List
|
| strCSV = Join(vArray, ",")
|
| but it returns a two dimentional array of (n, 9) bounds, with nulls in the
| 1-9 entries of every array, which can't be used in Join. The listbox has
only
| 1 column in the properties. Is there anyway to get a one dimentional array
| from a listbox? The listbox is programatically filled so it is not getting
| it's source from a worksheet range. Thanks.
|
| --
| *********************
| J Streger
| MS Office Master 2000 ed.
| MS Project White Belt 2003
|
| User of MS Office 2003
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Listbox to Array

I keep getting a type mismatch error when trying to use that function.

Surprisingly it is not in Intellisense, but Excel seems to function when I
pass a blank array through it. I've never seen that function before now.
--
*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003

User of MS Office 2003



"Jim Rech" wrote:

How about:

vArray = Application.Transpose(ListBox1.List)

--
Jim
"J Streger" wrote in message
...
|I was looking for a faster way to get all the values in a listbox. I have
| this code:
|
| Dim vArray As Variant
| dim strCSV as String
|
| vArray = Lbox.List
|
| strCSV = Join(vArray, ",")
|
| but it returns a two dimentional array of (n, 9) bounds, with nulls in the
| 1-9 entries of every array, which can't be used in Join. The listbox has
only
| 1 column in the properties. Is there anyway to get a one dimentional array
| from a listbox? The listbox is programatically filled so it is not getting
| it's source from a worksheet range. Thanks.
|
| --
| *********************
| J Streger
| MS Office Master 2000 ed.
| MS Project White Belt 2003
|
| User of MS Office 2003
|



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
Data Array in Listbox? Max Excel Programming 1 October 29th 07 04:53 PM
populating a listbox from an array Graham Whitehead Excel Programming 2 August 2nd 06 01:11 PM
How do I pass an array to a listbox? Titus A Ducksass - AKA broken-record Excel Programming 4 March 23rd 05 07:20 PM
ListBox array Neil Excel Programming 1 November 24th 03 11:34 AM
Listbox and Array questions Stuart[_5_] Excel Programming 4 September 23rd 03 11:04 PM


All times are GMT +1. The time now is 08:24 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"