1. MultiDimensional Arrays (Excel 2000)

The Excel Help files not that you can declare an array with up to 60 dimensions. <img src=/S/headthrob.gif border=0 alt=headthrob width=15 height=15>!
Then they wimp out by only showing you how to declare a two dimensional array.
How would you declare a 3 or 4 dimensional array and can you help me visualize what it would look like?

thanks

2. Re: MultiDimensional Arrays (Excel 2000)

You can think of a one-dimensional array as a row of elements and of a two-dimensional array as a rectangle of elements, arranged in rows and columns.
A three-dimensional array can be visualized as a kind of cube, with width, height and depth.

You would declare a three-dimensional array as follows:

Dim arrThree(3,5,4) As Integer

This will create an array whose first dimension ranges from 0 to 3, the second from 0 to 5 and the third from 0 to 4. An element of this array is arrThree(2,0,4).

We can't really visualize four- and higher-dimensional arrays, but we can still create and use them:

Dim arrFour(1 To 5, 1 To 6, 2 To 5, 0 To 4) As String

This will create an array whose first dimension ranges from 1 to 5, etc. An element of this array is of the form arrFour(1, 4, 3, 0).

3. Re: MultiDimensional Arrays (Excel 2000)

So could you use 3+ dimensional arrays to contain data like the sheets in a workbook?

4. Re: MultiDimensional Arrays (Excel 2000)

Yes, you could think of an Excel workbook as a three-dimensional array, with rows, columns and worksheets as dimensions.
To carry this one step further, imagine a folder full of Excel workbooks, each with worksheets Sheet1, Sheet2 and Sheet3. You can view the data in this collection of workbooks as a four-dimensional array with dimensions rows, columns, worksheets and workbooks.

5. Re: MultiDimensional Arrays (Excel 2000)

Do you have any suggestions for resources on Arrays? (besides yourself of course <img src=/S/grin.gif border=0 alt=grin width=15 height=15>).