+ Reply to Thread
Results 1 to 4 of 4

carry value of a variable to another mdule

  1. #1
    Registered User
    Join Date
    10-18-2012
    Location
    Missoula, MT
    MS-Off Ver
    Excel 2010
    Posts
    8

    carry value of a variable to another mdule

    I have a module that runs when the workbook is open. It collects certain info that I want to carry over to another module. I have declared a variable in the general area of the module as public and it gets assigned a value within the module itself. How do I carry that value over to the second module?

  2. #2
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: carry value of a variable to another mdule

    As long as you have declared the variable at the top of the module (before any subs) it should carry over. I have a program i wrote that uses 4 different modules with variables that cross over. Let me know if this does not work for you or if you have already tried this.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-18-2012
    Location
    Missoula, MT
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: carry value of a variable to another mdule

    I have declared the variable at the top of the "thisworkbook" module. This module runs at automatically at the time the workbook opens.
    After this module is complete, sheet1 is activated and I gather more info. Then a command button is pushed and the sheet1 module runs. Variable value is not in place. Not sure if I have to 'store' it someplace or not
    thanks for the reply.

  4. #4
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: carry value of a variable to another mdule

    Ah, I am not sure how the workbook macros interact with actual modules, if at all. I would try storing it an unused cell and just paint it white!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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