+ Reply to Thread
Results 1 to 2 of 2

How to export a variable from a userform to another?

Hybrid View

  1. #1
    Registered User
    Join Date
    01-27-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2007
    Posts
    75

    How to export a variable from a userform to another?

    Hi,

    I created a userform to find sheets that has a specific word in its names (typed in a textbox); worksheets' numbers are stored in a vector MySheets(j)

    So, I would like to open a userform with a spinbutton (or 2 buttons) to scroll through these sheets, openning it with something like:


    Private Sub SpinButton1_SpinUp()
        Sheets(MySheets(SpinButton1.Value)).Select
    End Sub

    But, this new userform2 doesn't recognizes "MySheets(j)". So, I'd like to know how to "export" "MySheets()" from a userform to another or how to send the typed word (from useform1/textbox1) to userform2.

    Thanks
    Last edited by marlonsaveri; 08-07-2012 at 07:53 PM. Reason: grammar

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: How to export a variable from a userform to another?

    Try inserting a standard module into your VBA project.

    In the standard module, use the following code:

    Public mysheets() as variant
    Does this help?

+ 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