Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock 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
Dec 2, 2005
13
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
 
Replies continue below

Recommended for you

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