Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using arrays from different modules

Status
Not open for further replies.

ljavier34

Mechanical
Joined
Dec 2, 2005
Messages
13
Location
US
This question might seem trivial to many...I'm just not too familiar with VBA...Anyways, I have different modules set up, each creates an array of data that it reads from excel. I now need to use these arrays and be able to compare them and do some calculations. My idea was to create a new module, where I would call the arrays, but I don't know how to do this...Any help would be greatly appreciated...

Thank you,

JJBL
 
I got it...In case anybody finds themselves with the same question,

All you need to do is define your variable (arrays in this case) as public outside of the Subs and make sure you run the module where you define it before you want to use the variable in a different module...
 
Another idea is to pass your array to the other sub as a parameter. This can avoid the use of global variables and the potential headaches caused by them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top