ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Arrays (https://www.excelbanter.com/excel-programming/282376-arrays.html)

Torbjörn Steijer

Arrays
 
Hi,

I have an array created in one procedure that I would like to use in another
procedure. How can I make the array in first procedure available in other
procedures?

TIA

Torbjorn



Chip Pearson

Arrays
 
Torbjorn,

Declare the array as a public variable, prior to and outside of any
procedure in the module.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Torbjörn Steijer" wrote in message
...
Hi,

I have an array created in one procedure that I would like to use in

another
procedure. How can I make the array in first procedure available in other
procedures?

TIA

Torbjorn





onedaywhen

Arrays
 
Or you could pass it as a variant argument e.g.

Sub Proc1()
Proc2 Array("Hello")
End Sub

Sub Proc2(ByVal ArgArray As Variant)
MsgBox ArgArray(0)
End Sub


"Chip Pearson" wrote in message ...
Torbjorn,

Declare the array as a public variable, prior to and outside of any
procedure in the module.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Torbjörn Steijer" wrote in message
...
Hi,

I have an array created in one procedure that I would like to use in

another
procedure. How can I make the array in first procedure available in other
procedures?

TIA

Torbjorn




All times are GMT +1. The time now is 07:19 PM.

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