ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Declare Multidimensional Arrays (https://www.excelbanter.com/excel-programming/274873-re-declare-multidimensional-arrays.html)

Alan Beban[_3_]

Declare Multidimensional Arrays
 
Leo,

I don't find any post by you on that date in my archives of this group
nor in a Google Search (other than the post below).

Alan Beban

Leo Heuser wrote:
I answered your very same question in this group on 11 Aug,
but you never replied, so it's difficult to see, what you're after.



Leo Heuser[_2_]

Declare Multidimensional Arrays
 
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


--
Best Regards
Leo Heuser
MVP Excel

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

"Alan Beban" skrev i en meddelelse
...
Leo,

I don't find any post by you on that date in my archives of this group
nor in a Google Search (other than the post below).

Alan Beban

Leo Heuser wrote:
I answered your very same question in this group on 11 Aug,
but you never replied, so it's difficult to see, what you're after.





Alan Beban[_3_]

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




Brent McIntyre

Declare Multidimensional Arrays
 
Leo and Alan,

Thank you very much for your help, unfortunately I to
lost track of where your previous comments were on the
Microsoft Community and DevelopersDex wouldn't let me
reply for some reason so I had to start a new topic.

This information was exactly what I needed.

Keep up the good work !

Yours sincerely,

Brent McIntyre


All times are GMT +1. The time now is 11:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com