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

This is my first attempt to create a multidimension array and I'm failing
miserably.

Part A:
I am trying to take data from text files and insert them into an array.
I know how to open the files and get the data.

This is what I know:
The number of files are not consistent.
The number of line items in each file is not consistent.

I would like to create an array, and input the data from the text file into
the array.
Repeat for each file.

ex:
FILE1:
Desc-1
item1
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Create and Update Multidimensional Array

Part B...
http://support.microsoft.com/kb/213748/en-us
"How to Populate One List Box Based on Another List Box"
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"TroyH.PHS"
wrote in message

-snip-

Part B:
I have a userform with 2 listboxes side by side.
The left listbox (listbox1) will contain the first item in each row of the
array or column 1. (ex: Desc-1, Desc-2, Desc-3, etc.)

The right listbox (listbox2) will contain the remaining items past the first
column and is determined by which item is selected in listbox 1 (item1 ...
itemXX)

I don't really have any code as I keep erroring out with just trying to get
it started.
Can anyone help?
Thanks.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Create and Update Multidimensional Array

Part A:

Dim textArr(noOfFiles -1, maxNoOfItems)
Dim i As Integer, j As Integer

i = 0
j = 0
For i To noOfFiles
textArr(noOfFiles, 0) = getDescr() 'first item of second dimension is
always description
For j To noOfItems
textArr(noOfFiles, j +1) = getItem()
Next j
Next i

Part B:

You would populate the first ListBox with your textArr like so:

Dim i As Integer

For i = 0 To UBound(textArr, 1)
lstBox1.add textArr(i, 0)
Next i

And in your second ListBox's change event, you want something like
this:
Dim indx As Integer
indx = lstBox1.ListIndex
If indx = 0 Then
Dim i As Integer

i = 1
while (i <= UBound(textArr, 2) And (textArr(indx, i) < "")
lstBox2.add textArr(indx, i)
i = i + 1
wend
Else
lstBox2.clear
End If

Regards,
Steve

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
Multidimensional array - lookup Jason Morin Excel Programming 5 September 27th 06 06:49 PM
Syntax for multidimensional array Arne Hegefors Excel Programming 1 August 22nd 06 06:19 PM
Sort MultiDimensional Array Mushi Excel Programming 1 August 2nd 06 05:34 AM
Multidimensional Array DavidMoeller Excel Programming 4 August 12th 04 08:12 PM
MAX of Multidimensional Array ZZZ Excel Programming 2 November 15th 03 03:32 PM


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