+ Reply to Thread
Results 1 to 6 of 6

Can I Force Re-Evaluation of Dynamic Lists while a Userform is Open?

  1. #1
    Forum Contributor
    Join Date
    03-26-2015
    Location
    Cookeville, TN
    MS-Off Ver
    Excel 365
    Posts
    202

    Can I Force Re-Evaluation of Dynamic Lists while a Userform is Open?

    I've got an unusual problem that may not have a solution, but wondering if anyone knows for sure...

    I have a Userform which includes 5 fields that are chosen from a list of, say, 15 choices. The main list (15 choices) is fixed. But, for example, if the user selects "Apples" in the first field, then the dropdown list in the second field will only have 14 choices (with "Apples" removed, so the user can't make the same choice in two of the fields). Likewise, after the user selects the second field, that choice (as well as "Apples") gets removed from the dropdown list for field 3, etc.

    In addition, the dropdowns for fields 2 thru 5 show only ONE choice (a "blank", empty choice) until a selection is made in the field immediately before it. This prevents the user from making a selection (for example) in field 2, before field 1 has been entered.

    I've already created 5 separate dynamic lists (for the 5 dropdowns), and they function as I've intended. But I have a problem. When the Userform is opened, the lists for fields 2-5 contain only one entry (the blank entry). When the user makes a selection in field 1, the physical list for field 2 is correctly updated (to a 14-entry list), and the named range (that's the RowSource for field 2 in the Userform) is correctly updated from a 1-cell range to a 14-cell range. But apparently the Userform only evaluates RowSource when the Userform is first opened, because the dropdown for field 2 still only shows one entry. It shows the first entry (of the 14 desired choices), but ONLY that first entry. So the Userform thinks RowSource is still referring to the original (1-cell) named range.

    Is there any way to force the Userform to re-evaluate the RowSource named range(s) for fields 2-5, while the Userform is open?

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Can I Force Re-Evaluation of Dynamic Lists while a Userform is Open?

    I never use row source it is too unwieldy.

    Use

    Please Login or Register  to view this content.
    in the userform activation event Instead.

    Then you can refresh it whenever you want.


    If you need to you can clear the combobox.

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Contributor
    Join Date
    03-26-2015
    Location
    Cookeville, TN
    MS-Off Ver
    Excel 365
    Posts
    202

    Re: Can I Force Re-Evaluation of Dynamic Lists while a Userform is Open?

    Thanks, that was simpler than I expected! But then I'm new to UserForms, so still in the learning stages.
    This raises another question, so I'll search for an answer to that, and if unsuccessful, I'll post a new thread for that. Thanks again!

  4. #4
    Forum Contributor
    Join Date
    03-26-2015
    Location
    Cookeville, TN
    MS-Off Ver
    Excel 365
    Posts
    202

    Re: Can I Force Re-Evaluation of Dynamic Lists while a Userform is Open?

    Mehmetcik,
    Well, I can't find an answer, and since you specifically recommend using the List property:
    Please Login or Register  to view this content.
    I'll ask my new question here. I'd like to use a named range to set the ComboBox list. But when I try:
    Please Login or Register  to view this content.
    (where RangeName is a dynamic range name), I get:

    Run-time error '381':
    Could not set the List property. Invalid property array index.

    So why can't I use a named range to set the List? How do I fix this? I've searched in vain online, and every example I can find simply shows the AddItem method being used to add single items of plain text (like "Bananas"). No examples of using named ranges! Help!

  5. #5
    Forum Contributor
    Join Date
    03-26-2015
    Location
    Cookeville, TN
    MS-Off Ver
    Excel 365
    Posts
    202

    Re: Can I Force Re-Evaluation of Dynamic Lists while a Userform is Open?

    Oh, and as a follow-up, assuming I can figure out how to get my ComboBoxes properly filled (using my named range), if I then want to remove whichever item was selected in ComboBox1 from the list of choices in ComboBox2, do I use:
    Please Login or Register  to view this content.
    or maybe:
    Please Login or Register  to view this content.
    or maybe even simply:
    Please Login or Register  to view this content.
    (I realize that the above would have to be in something like the ComboBox2_Click event, not in the UserForm initialization)

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Can I Force Re-Evaluation of Dynamic Lists while a Userform is Open?

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mehmetcik; 07-02-2017 at 04:26 PM.

+ 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] CF force 2nd condition evaluation
    By drgkt in forum Excel General
    Replies: 4
    Last Post: 06-16-2017, 02:24 AM
  2. [SOLVED] Dependent Dynamic Lists for Userform Comboboxs
    By bharbir in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-22-2013, 01:58 AM
  3. Userform won't open with worksheet. Causing error and force close.
    By drew.j.harrison in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-30-2013, 10:51 AM
  4. Resizing lists when userform is open
    By Skybeau in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-26-2011, 09:44 PM
  5. Force Re-Open of Open Workbook with no confirmation
    By Orson100 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2009, 11:07 AM
  6. Need a macro to loop evaluation of many textboxes in a UserForm.
    By excelnut1954 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-24-2006, 10:35 PM
  7. [SOLVED] force evaluation of text
    By Light in forum Excel General
    Replies: 3
    Last Post: 03-15-2006, 11:00 AM

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