ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Array Declaration (https://www.excelbanter.com/excel-programming/313891-array-declaration.html)

mikey10[_6_]

Array Declaration
 

Hi

I'm trying to use an fixed array. Several macros will need to use thi
array and the contents of the array will be subject to continuou
changes.
Where and how do I declare the existence and size of this array?
Regards,
Mike
:

--
mikey1
-----------------------------------------------------------------------
mikey10's Profile: http://www.excelforum.com/member.php...fo&userid=1537
View this thread: http://www.excelforum.com/showthread.php?threadid=27020


Myrna Larson

Array Declaration
 
If you write

Dim MyArray(1 to 30) As Variant

at the top of the module, outside of any procedures, it will be available to
all procedures in the module. Note that what I wrote is a fixed-sized or
static array. You can't change the size with a Redim statement. If you want to
do that, write it as

Dim MyArray() AS Variant

One of your procedures must, of course, use Redim to set the size.


On Mon, 18 Oct 2004 12:43:24 -0500, mikey10
wrote:


Hi

I'm trying to use an fixed array. Several macros will need to use this
array and the contents of the array will be subject to continuous
changes.
Where and how do I declare the existence and size of this array?
Regards,
Mike
:)



Jim Rech

Array Declaration
 
Several macros will need to use this array

Then you should declare it at the top of a standard module:

Dim MyArray(1 to 100, 1 to 2) as String

If some of the routines that will use the array are in other modules then
you have to declare the variable as Public:

Public MyArray(1 to 100, 1 to 2) as String

--
Jim Rech
Excel MVP
"mikey10" wrote in message
...
|
| Hi
|
| I'm trying to use an fixed array. Several macros will need to use this
| array and the contents of the array will be subject to continuous
| changes.
| Where and how do I declare the existence and size of this array?
| Regards,
| Mike
| :)
|
|
| --
| mikey10
| ------------------------------------------------------------------------
| mikey10's Profile:
http://www.excelforum.com/member.php...o&userid=15378
| View this thread: http://www.excelforum.com/showthread...hreadid=270204
|




All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com