View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban[_3_] Alan Beban[_3_] is offline
external usenet poster
 
Posts: 130
Default Declare Multidimensional Arrays

By the way, Leo, after a more sensible search on Google I found your
post. I, too, am on msnews.microsoft.com, but sorting by date it shows
nothing for between August 4th and today.

Oh well,
Alan

Leo Heuser wrote:
Thanks, Alan.
Very strange indeed! I just did a search in my
archive of this group and found my answer right away.
I'm on the msnews.microsoft.com server

Here then is my answer in case Brent also can't
find it. Very much like your own solution.

-----------------------------

Hello Brent

Here's one way to do it, if I have understood you
properly. All Array() must have the same number
of elements (here 3)


Sub CreateArray()
'Leo Heuser, 11 Aug. 2003
Dim lColumn As Long
Dim EndArray() As Variant
Dim lRow As Long
Dim PartArray(2) As Variant


PartArray(0) = Array("a", "b", "c")
PartArray(1) = Array("d", "e", "f")
PartArray(2) = Array("g", "h", "i")

ReDim EndArray(1 To UBound(PartArray) + 1, UBound(PartArray(0)))

For lRow = LBound(EndArray, 1) To UBound(EndArray, 1)
For lColumn = LBound(EndArray, 2) To UBound(EndArray, 2)
EndArray(lRow, lColumn) = PartArray(lRow - 1)(lColumn)
Next lColumn
Next lRow

For lRow = LBound(EndArray, 1) To UBound(EndArray, 1)
For lColumn = LBound(EndArray, 2) To UBound(EndArray, 2)
MsgBox "(" & lRow & "," & lColumn & ") " & _
EndArray(lRow,lColumn)
Next lColumn
Next lRow
End Sub