switters_aka
Board Regular
- Joined
- Oct 26, 2010
- Messages
- 118
Hello,
I am trying to write a piece of code that populates arrays inside a loop. The problem I can't think of solution for is that every time the code runs the number of arrays will be different. This presents a problem for array declaration so I thought it might be possible to declare the array within the loop using SubArrayi where i is the loop variable. E.g.
Dim SubArray & i is not acceptable VBA syntax though and it might not even be possible to declare the array in such a manner so if someone could please help me handle array declaration where the number of arrays is initially unknown, I would really appreciate it.
Thanks to anyone who can offer any help.
I am trying to write a piece of code that populates arrays inside a loop. The problem I can't think of solution for is that every time the code runs the number of arrays will be different. This presents a problem for array declaration so I thought it might be possible to declare the array within the loop using SubArrayi where i is the loop variable. E.g.
Code:
For i = 1 to UBound(MainArray)
Dim SubArray & i as Variant
'populate SubArrayi
Next i
Dim SubArray & i is not acceptable VBA syntax though and it might not even be possible to declare the array in such a manner so if someone could please help me handle array declaration where the number of arrays is initially unknown, I would really appreciate it.
Thanks to anyone who can offer any help.