Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default newbie redim question

If you want to make the array dynamic, don't start by dimensioning it

Public ManualDataArray

--

HTH

RP
(remove nothere from the email address if mailing direct)


"KR" wrote in message
...
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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie question Ekaterina Charts and Charting in Excel 2 January 30th 07 06:59 PM
Real Newbie newbie question Dave New Users to Excel 0 January 10th 07 07:55 PM
newbie question [email protected] Excel Worksheet Functions 5 July 12th 06 01:25 PM
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM
newbie question cyclingsal Excel Programming 1 May 7th 04 08:52 PM


All times are GMT +1. The time now is 01:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"