+ Reply to Thread
Results 1 to 5 of 5

Accessing variables assigned in one userform by a second userform?

  1. #1
    Forum Contributor
    Join Date
    03-13-2009
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    136

    Accessing variables assigned in one userform by a second userform?

    I have a userform that performs a few calculations with some user input data and then sets up a second userform to obtain additional inputs. When the user clicks continue on the second userform, the data on the second form is saved to an array. I think I have probably stumbled on the most convoluted way possible of doing this and I have hit a road block. My controls within the second userform are set up within the code of the first userform which means my controls.value are private variables of the first userform. The problem is that the code within the second userform for Continue_Click() can't access these variables. How should I be setting this up?

    The Relevant Code is:
    Please Login or Register  to view this content.
    And then my code for Form3 is:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Accessing variables assigned in one userform by a second userform?

    How about providing a sample workbook, the relevant code you posted relates to data for userform3 not 2.
    Not all forums are the same - seek and you shall find

  3. #3
    Forum Contributor
    Join Date
    03-13-2009
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    136

    Re: Accessing variables assigned in one userform by a second userform?

    Quote Originally Posted by Simon Lloyd View Post
    How about providing a sample workbook, the relevant code you posted relates to data for userform3 not 2.
    I apologize. I wasn't clear. The first code block above pertains to a commandbutton click on userform2. The second code block refers to a commandbutton click on userform3. I will put together a sample workbook to make it clear what I am trying to do.

  4. #4
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Accessing variables assigned in one userform by a second userform?

    Great!, that helps us see what problems you may or do run in to and provide a better solution. Remember that the structure and data types should remain the same.

  5. #5
    Forum Contributor
    Join Date
    03-13-2009
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    136

    Re: Accessing variables assigned in one userform by a second userform?

    If you run the module named CreateReport it will run the pieces of code that I am having problems with. I have precompleted the form with the initial data values.
    Attached Files Attached Files

+ 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