+ Reply to Thread
Results 1 to 3 of 3

VBA - Simple example for passing a variable between modules

  1. #1
    Registered User
    Join Date
    08-16-2010
    Location
    Leicester, England
    MS-Off Ver
    Excel 2000
    Posts
    4

    Question VBA - Simple example for passing a variable between modules

    After getting to know VBA quite well there is still one issue I am having, I can't seem to get my head around passing values between modules. I hope someone here might be able to aid me in a simple theoretical example that will help me and hopefully others.

    Please Login or Register  to view this content.


    Please Login or Register  to view this content.

    All I am after is for someone to point me in the right direction on how to pass variable x to the second module, and then return y back to module1 and continue with the new calculated value.

    Many thanks in advance!

    Ryan.
    Last edited by Ryanside; 03-15-2012 at 07:49 AM.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: VBA - Simple example for passing a variable between modules

    How about this?

    Please Login or Register  to view this content.
    That's how I'd do it.

  3. #3
    Registered User
    Join Date
    08-16-2010
    Location
    Leicester, England
    MS-Off Ver
    Excel 2000
    Posts
    4

    Re: VBA - Simple example for passing a variable between modules

    Thank you very much, highlighted where I was going wrong too. The use of function rather than sub here is key!

    Edit: If a mod could close and mark as solved I think we are done here
    Last edited by Ryanside; 03-14-2012 at 06:36 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1