Results 1 to 7 of 7
  1. #1
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    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
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    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. #3
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: MultiDimensional Arrays (Excel 2000)

    So could you use 3+ dimensional arrays to contain data like the sheets in a workbook?
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    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. #5
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    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>).
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: MultiDimensional Arrays (Excel 2000)

    For example MSDN. Don't forget to click "See Also" after reading it.

  7. #7
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: MultiDimensional Arrays (Excel 2000)

    thanks!
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •