how to increase dimension of n array
how to increase dimension of an array by a set number of variable?
for example i have an array
dim co(n) as double
where n is a user defined number.
and every time i do certain operation on
array co(n), i want that its dimension sould increase by same "n" number.
Re: how to increase dimension of n array
Use The ReDim Statement:
Dim TestArray() as Double
Dim ArraySize as integer
'Variable to Determine The Size Of The Array
ArraySize = 10
'Dimension The Array to A Variable Value
Redim Preserve TestArray(ArraySize)
The Preserve keyword saves all data already in the array. If you don't want to save the data
dimesion the array as follows:
Redim TestArray(ArraySize)
Hope This Helps
Re: how to increase dimension of n array
Looks like a great suggestion. Only thing I would change is use 2 variables for maintaining size. One could be Arraysize and the other ArrayIncrease. Then you could do:
ArraySize = ArraySize + ArrayIncrease
Redim Preserve TestArray(ArraySize)
each time you need to get a little bigger.
thanx/good luck,
adam