Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
See inline comment....
Your original post, and the answer I provided to it at the time, were not lost. Here is a link to the Google archives for it... http://groups.google.com/group/micro...460582ed4ea3de Or, to make it independent of 0-Base/1-Base: Sub Rothstein() Dim X As Long Dim Arr1 As Long Dim Arr2 As Long Dim VarArray As Variant ' We use VarArray to hold two elements, ' each of which is an array. VarArray = Array(Array("A", "B"), Array("C", "D", "E", "F")) ' Note the syntax to address each array... a double pair of ' parentheses... the first set address which array member of ' VarArray we want, the second set addresses the element ' of the member array we want. Arr1 = LBound(VarArray) Arr2 = UBound(VarArray) Good thought about making the assignments automatic; however, I think the above line should more properly be this... Arr2 = Arr1 + 1 The ArrX variables are indexes for the VarArray itself... Arr1 points to the first stored array and Arr2 points to the second stored array (I did that to make the "structure" similar to the OP's intial naming convention). While your code works for the given example, the OP might find it more difficult to extrapolate it if he chose to put 3 or more arrays into varArray. I think he would be able to guess that a 3rd stored array would have Arr3=Arr2+1 more easily using my suggestion. Rick Debug.Print "******** Arr1 member elements ********" For X = LBound(VarArray(Arr1)) To UBound(VarArray(Arr1)) Debug.Print VarArray(Arr1)(X) Next Debug.Print "******** Arr2 member elements ********" For X = LBound(VarArray(Arr2)) To UBound(VarArray(Arr2)) Debug.Print VarArray(Arr2)(X) Next Debug.Print "******** DONE ********" End Sub Alan Beban |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Dim an Array with a variable | Excel Programming | |||
Array & variable | Excel Programming | |||
how can I see if an array contain a certain variable? | Excel Programming | |||
about ARRAY variable | Excel Programming | |||
Problem trying to us a range variable as an array variable | Excel Programming |