View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JulieD JulieD is offline
external usenet poster
 
Posts: 618
Default using arrays in vba

Hi All

trying to come to grips with arrays ... i have the situation where i am
getting users to enter up to 60 numbers in a userform, i then need to use
these numbers in lots of different ways. So i have declared an array and i
populate it by cycling through the controls etc (all this works fine).
However, when i Dimmed the array i nominated the number of elements ..
Dim pipes(59) as long

but, of course if they don't enter 60 elements the array is too big. Now i
know that i could count the number of items (prior to populating the array)
and use the redim statement to set the size, but this seems like a bit of a
waste of time ... i've tried redim preserve after populating the array but
get told that the array has already been something or other (sorry not in
front of the screen and can't remember the exact wording).

what i would like to do is define & populate the array in the most efficient
way possible ... and would welcome any suggestions.

Regards
JulieD