View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
lvcha.gouqizi lvcha.gouqizi is offline
external usenet poster
 
Posts: 38
Default keep recursion result (a dynamic array) without using global variable

Hi there,

I write a recursive subroutine which can be called by several macros
from different modules. I want to keep a dynamic array as a result of
this recursive code. I define an array as a global variant like:
Dim result() as Variant
Redim result(1 to 5, 1 to 20)

And whenever the recursion gets a correct answer, I add it to the
array. The recursion works well when called by its own module. But when
code from other module calls it, I am confused about how to deal with
the global array? Is there any way to keep recursion results without
using global variable?

Can I use a dynamic array parameter and an integer paramter to save its
increasing size like the following?

sub myrecursion(dynArr() as variant, dynArrLen as integer)

Thanks.
lvcha