View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default newbie redim question

I need to create a 2-D _public_ array, and the size of the second dimension
needs to be based on a number from one of my procedures- so if I understand
correctly, I need to dim the array at the top of a module to make it public,
then redim it once I know what size the second dimension needs to be.

At the top of my module, I have:
Public ManualDataArray(1 To 2, 1 To 500) As Variant

And within a sub, I try:
ReDim ManualDataArray(1 To 2, 1 To MaxTestRows)

I don't need to preserve anything, as I am redim'ing right before populating
the array.

Unfortunately, when I try to run my sub, I get:
Compile error: Array already dimensioned.

The help file only gives examples of redim'ing a one dimensional array, so I
have no idea how to change the syntax so I can redim this array properly.

I appreciate your help!
Office 2003/Win2000
Keith

p.s. I am making the array public because I need to access it from several
different subs across several different modules. There may be a better way
to set it up, and it may impact the suggested solutions to my problem...I
just don't know the best way to set up my variables to ensure that (when
appropriate) they can be accessed from any of my code within a workbook.

--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.