Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Because all the the array element are 2D other than (35), I was wanting
to know if there is a way to use the Array function to make it 2D? I haven't been following this thread nor the logic behind your code; however, I did want to address this question for you. There is a way to do what you ask... sort of. This will only work with variables declared as Variant (which is the case for your question), but the syntax will be a little funny. Here is an example for a normal Variant variable, but you can apply the technique to your array of Variants as well (you will just have an extra set of parentheses for the Variant array index in addition to the ones shown below). Note, that while not necessary, I have assumed a "pure" multi-dimensional array in which there are the same number of columns in each row. Sub Test() Dim Row As Long Dim Col As Long Dim V As Variant ' ' Assign a 3 by 4 array to Variant variable V ' V = Array(Array(1, 2, 3), Array("A", "B", "C"), _ Array(5, 6, 7), Array("D", "E", "F")) ' ' Let's see the result of that assignment; and notice ' the double parentheses method of referencing the ' multi-dimensional array - V(Row)(Col) ' Debug.Print "Row Col Value" For Row = LBound(V) To UBound(V) For Col = LBound(V(LBound(V))) To UBound(V(UBound(V))) Debug.Print " " & Row & " " & Col & " " & V(Row)(Col) & _ " " & "V(" & Row & ")(" & Col & ")" Next Next End Sub -- Rick (MVP - Excel) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Export 1-dimensional array values to a two-dimensional table? | Excel Programming | |||
Changing a two-dimensional, one row array to one-dimensional | Excel Programming | |||
Returning an array from a multi-dimensional array | Excel Programming | |||
Mutli-dimensional Array to Single-Dimension Array | Excel Programming | |||
Create One-Dimensional Array from Two-Dimensional Array | Excel Programming |