Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dynamic multidimensional arrays
Give this a whirl... The perserve key word keeps the values that may already
be in the array. Without it any values in the array would be lost. Not neseccary in this case... Sub test() Dim ary() As Integer ReDim Preserve ary(10, 10) ary(0, 0) = 1 ary(0, 1) = 2 End Sub Note that you can still resize the array at any time but you can only resize the last dimension... -- HTH... Jim Thomlinson "ispy99" wrote: All, I am trying to write some VBA code for an excel application. I need to read in a CSV file with a set number of fields but variable number of rows. I have been able to open the file and read the contents, however I am having a problem loading the data into an array. I believe I am simply not understanding how to work with multidimensional dynamic arrays. In this case I have two fields with a variable number of rows. I know in other languages like Java I would instantiate a Vector (for example) and then add as many elements as I needed. VBA seems to require knowing the size of the array when it is created with Dim. Any suggestions? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
MultiDimensional Dynamic Arrays | Excel Programming | |||
Declare Multidimensional Arrays | Excel Programming | |||
Declare Multidimensional Arrays | Excel Programming | |||
Multidimensional Arrays - VBA | Excel Programming | |||
Multidimensional Arrays - VBA | Excel Programming |