View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Multi Dimensional Array

All assumes you have Option Base 1
You can create dynamic multi dimensional arrays, but you can only re-dim the
last dimension
In your case, you ideally want an x * 3 array.
So you have 2 choices:
1. Transpose the array so you can dynamically add extra "records" up to the
max of 33
Dim MyArray()
ReDim MyArray(1 To 3, 1 To 2)
'Some code
ReDim Preserve MyArray(1 To 3, 1 To 4)

2. Start off with the max size and potentially have some unfilled elelments
Dim MyArray(1 To 33, 1 To 3)

NickHK


"andym" wrote in message
oups.com...
Dear All,

I wish to create a 3 x n multi dimensional array.

I basically want to do the following:

1. Start off in cell "A1"
2. travel down through 100 cells
3. If activecell contains criteria (eg. has a certain value) then
collect this value, and the value of the next 2 corresponding columns
(adjacent cells).
4. Paste these 3 x n cells of data in another area of the sheet.

eg.. out of the 100 cells looped, I may end up with 33 rows of data
that meet the criteria, therefore have a total of 99 elements in the
array.

I have a good understanding of single arrays, but could somebody please
guide me on such a multi-dimensional array? All the searches I have
undertaken so far don't seem to illustrate this type of array
population.

Regards,

andym