+ Reply to Thread
Results 1 to 6 of 6

Return array from UserForm

  1. #1
    Registered User
    Join Date
    04-05-2017
    Location
    Houston, TX
    MS-Off Ver
    2016
    Posts
    57

    Return array from UserForm

    I'm trying to make a userform for the first time and it's not going well. I have command button on a worksheet that when clicked opens a userform with 3 checkboxes. Depending on which boxes are checked I would like to modify an array for use later on in the command button's sub.

    I can't figure out how to build the array in a way that allows me to use it in the sub though. Any assistance would be greatly appreciated. My code is attached.
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Return array from UserForm

    What do you want in the array?

    Do you just want a 1/0 for each checkbox?

    If you do then something like this might be what you are looking for.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    04-05-2017
    Location
    Houston, TX
    MS-Off Ver
    2016
    Posts
    57

    Re: Return array from UserForm

    How do I use the options array afterwards in the CommandButton1_Click private sub?

    Please Login or Register  to view this content.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Return array from UserForm

    What do you want to do with the array?

  5. #5
    Registered User
    Join Date
    04-05-2017
    Location
    Houston, TX
    MS-Off Ver
    2016
    Posts
    57

    Re: Return array from UserForm

    I have a while loop later in the CommandButton1_Click sub. I want to skip iterations of the loop based on the options selected by the user.

    For example if the loop runs three times by default I want it to skip the second iteration if the options array has the values [1 0 1].

  6. #6
    Registered User
    Join Date
    04-05-2017
    Location
    Houston, TX
    MS-Off Ver
    2016
    Posts
    57

    Re: Return array from UserForm

    I can get the userform to write the array to a worksheet and then read those back into a new array in the sub but I would like to find a way to get around the intermediate step.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Msgbox from Userform - how to return to Userform and retain the inputs
    By nickersonpower in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-05-2017, 12:14 PM
  2. Find max in array, return corresponding value in array, without max function
    By cshwkhelp in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-07-2017, 11:26 PM
  3. Exit Userform to return to main code, but keep userform open
    By jombler74 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 09-04-2014, 04:01 AM
  4. Double click row to return data to userform for edit then return back to sheet
    By MattRSJ in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 01-31-2014, 06:05 AM
  5. Search an array with an array and return matching value
    By cheal2 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-23-2013, 04:15 PM
  6. [SOLVED] Lookup a value in one array, and return a corresponding column/row in another array
    By Gunther Maplethorpe in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-15-2012, 08:47 PM
  7. Find a value in an array and return multiple values in an adjacent array
    By tonbra in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2012, 08:35 PM

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