Ping Alan Beban: ResizeArray

R

Rhumba

I've been resizing arrays using Alan's excellent ResizeArray routine,
but suddently noticed that when I sent 2D arrays in, the second
dimension of the array was not getting updated. Then I saw that once
the first dimension reached like 26K (due to a bug elsewhere in my
code), it didn't get any bigger either.

Assuming the array is not of type "object," you invoke this bit of
code:

For i = LBound(myArray, 1) To _
Application.Min(UBound(myArray, 1), newDim(1))
For j = LBound(myArray, 2) To _
Application.Min(UBound(myArray, 2), newDim(2))
arr1(i, j) = myArray(i, j)
Next
Next

Probably this should be obvious, but why are you taking the minimum of
the old array size and the new? I'm not sure now how the first
dimension of a 2D array ever gets bigger because of the presence of
that Application.Min test.

Thanks in advance for any help.
 

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