You may prefer using a Collection, but in either case, you will need to declare the array as a Public variable in a normal module, so it will not pass out of scope.
Note that this is for a 0-based array. And that much of the code is handling to deal with the case of the very first running of Test, where the Array hasn't been dimensioned yet.
Another approach would be to have a fixed size array, larger than you will ever need, and use a companion public variable to indicate what the highest index being used is.
This works best with a 1-based array, since when you just start Excel, the value of ArrayElementCount is 0.
The Collection approach is actualy simpler, because the start-up state is easier to detect and that code can be included in the class's Intialize event
Bookmarks