Redim 2D Array Subscript Out Of Range Error
"lopsided " wrote in message
...
Hi,
I have written some code to extract data from a source into an array,
this code worked fine until I decided I needed 2 pieces of info for
each piece of data. This caused a subscript out of range error in the
Redim Preserve statement line.
k = 1
ReDim varChargeArray(1 To k, 1 To 2)
While Not IsEmpty(ActiveCell)
If ActiveCell.Value = "T" Then
ReDim Preserve varChargeArray(1 To k, 1 To 2) !!ERROR
HERE!!
You cant resize the lower bound of an array using the
preserve keyword
What you need to do is make your lower bound array
sufficiently large to start with
Keith
|