×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Using arrays from different modules

Using arrays from different modules

Using arrays from different modules

(OP)
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

RE: Using arrays from different modules

(OP)
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...

RE: Using arrays from different modules

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources