Resize a variant array

J

Jean-Pierre Bidon

Hie,
I defined a class module with a variant Array member having "n" rows and "p"
columns.
In a method of the object, I need to resize the Array, in practice to add a
row.
So I had the idea of using the Redim instruction, ... but it doesn't work.
Is there any solution to do this resizing operation ?

-------------------------
MyClassObject
-------------------------
Dim vaMyArray 'Data member
----
Sub MyMethod 'Method

.....
Redim vaMyArray(UBound(vaMyArray,1) + 1, UBound(vaMyArray,2) '<= this
doesn't work
.....

End sub
------------------------
Thank you.

Jean-Pierre Bidon
Interstat
91 rue de Rennes
75006 Paris
Tél: 01 45 49 19 17
 
G

Guest

the solution would be to transpose your thinking.

rather than

myarray(row,column)

use

myarray(column,row)

then you can resize the last dimension.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top