![]() |
Resize a variant array
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 |
Resize a variant array
the solution would be to transpose your thinking.
rather than myarray(row,column) use myarray(column,row) then you can resize the last dimension. -- Regards, Tom Ogilvy "Jean-Pierre Bidon" wrote: 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 |
All times are GMT +1. The time now is 01:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com