View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bradley Bradley is offline
external usenet poster
 
Posts: 16
Default Arrays in macros

Unfortunately the arrays vary any size for different times the subs are run.
So I have them as PUBLIC open array initially and then REDIM them for the
correct size just before populating them in the first sub.
I have tried to make this sub a function instead to pass the array with its
"new" info back to the initial sub and then pass this to the second sub where
the next series of calculations take place.
Unfortunately, it still reverts back to an empty array as it returns to the
initial sub before even being passed to the second sub.

Is there a way of stating the array in the sub name so that it passes the
array back with the new data?

"Gary''s Student" wrote:

The arrays need to be public and static. Just DIM them outside the subs, not
inside the subs and the values will "live" from sub call to sub call

Have a good day
--
Gary''s Student


"Bradley" wrote:

Within a sub procedure two other sub procedures are called consecutively.
The first sub procedure feeds values into an array.
I need this array with these values to then be used in the second sub
procedure.

As soon as the first sub procedure is complete the array becomes empty and
passes an empty array to the second sub procedure.
Thus givign me zero for all my calculations in the second array.

Please assist.