+ Reply to Thread
Results 1 to 5 of 5

Populate userform listbox based on value selected in another listbox

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Populate userform listbox based on value selected in another listbox

    See my enclosed file.

    I have a userform and on this form are two listboxes.

    The first listbox asks the user to select a "Report".

    Based on what report the user selects the 2nd list box is supposed to populate with the values for that report shown on the Misc_info_sht worksheet. I do read in the values of each of the reports into arrays and i was hoping to have the correct report array populate the 2nd list box.

    For example: If the user selects Report_2 then the values for Report_2 will populate the 2nd list box.

    I can get the first list box to populate but i am not sure how to get the 2nd list box to populate.

    Note: Macro start button is on the "Main" worksheet........

    Any ideas?
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Populate userform listbox based on value selected in another listbox

    dont use the file from previous post......i forgot to link macro button to actual code and i did not assign array correctly .......SO use this macro attached file..........thanks.
    Attached Files Attached Files

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Populate userform listbox based on value selected in another listbox

    Hi welches101
    Here's one way. Set up Named Ranges (see this Named Ranges.jpg
    Then assign this code to the ListBox1 Click Event
    Please Login or Register  to view this content.
    You probably should consider making your Named Ranges dynamic.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Populate userform listbox based on value selected in another listbox

    thanks jaslake,

    i will review your soln. thanks.

    i also came up with a soln ......probably not as good as yours but it works........i include it here in case someone wants to see it.
    Attached Files Attached Files

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Populate userform listbox based on value selected in another listbox

    Hi welches101

    You're welcome. If your issue is resolved please mark your Thread as SOLVED.

+ 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