View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default need some array help

Gary,

As mentioned, the variable part of an array should be the last dimension,
not the first.

But you should also be aware that Redim Preserve is a very process hungry
action and should not be overdone. It is better to Redim it before loading

dim arr() as string

redim arr(1 to itemnum.count, 1 to 6)

for n = 1 to itemnum.count
then code to add a values
next

If you don't know how many you will be loading, make a high guess, and then
Redim down to the actual size at the end.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
i want to store an unknown number variables in a 2 dimensional array and
can't figure out how to use redim preserve

here's what i tried

dim arr() as string

redim arr(1 to 1, 1 to 6)

for n = 1 to itemnum.count
ReDim Preserve arr(1 To n, 1 To 6)
then code to add a values
next

on the 2nd loop i always get an error
can someone enlighten me please?
--


Gary