View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
[email protected] EagleOne@discussions.microsoft.com is offline
external usenet poster
 
Posts: 391
Default How to code ReDim Preserve when "ReDim strArr(1 To 100, 1 To 3)"

This has been a great learning experience for me.

People like you give me hope for the world.

Thanks

"Rick Rothstein" wrote:

First off, the rule about being able to change ONLY that last dimension when
using the Preserve keyword is a 'fast and hard' rule... there is no way of
getting around it. The reason for its existence has to do with the way VB
stores arrays in memory. Now, if I understand what you are doing, the "1 To
3" dimension isn't going to change, only the "1 To 100" dimension will. If
that is the case, the only way to do what you want is to reverse how you
think of the dimensions. So, where you have...

strArr(1 To 100, 1 To 3)

then just reverse them...

strArr(1 To 3, 1 To 100)

and just specify them in the reverse of the way you do now. Doing this makes
the "1 To 100" dimension the last one and, hence, changeable when using the
Preserve keyword.