Dynamic MultiDimentional Array

j0se

Registered User.
Local time
Today, 16:15
Joined
Jan 15, 2003
Messages
57
I'm hoping somebody can help me with this:

I want to create an array inside the loop to record 2 sets of data: a name, and a number.

I don't know how many records the loop will run through, hence I need the array to be dynamic.

If anybody can help me out with some code, I would be most pleased
:)

Thanks
 
Dimension the array as dynamic:

Dim MyArray() as [Type]

Then, in your loop, use Redim Preserve and a counter to get your upper bound:

dim a as long
dim MyArray() as Long

a = 0
Do
redim preserve MyArray(a)
MyArray(a) = a
a = a+1
Loop Until a = 100
debug.print Join(MyArray,vbcrlf)
 
thanks

thank you!

that works great!
 

Users who are viewing this thread

Back
Top Bottom