+ Reply to Thread
Results 1 to 6 of 6

Display different list in a list box when specific drop down chosen

  1. #1
    Registered User
    Join Date
    03-18-2013
    Location
    canada
    MS-Off Ver
    Excel 2003
    Posts
    3

    Display different list in a list box when specific drop down chosen

    Hi, I'm new to the VBA and new to this forum.
    Really hope to gain more knowledge and experience with everyone of you in this forum.

    Currently I have project that I need to create a userform, within that userform, there are some drop downs and listbox.
    Most of the part I think I can handle it expect one criteria which is let say if first drop down box (A, B, C), user choose "A" and the listbox below will show "A" List. If user choose "B", then listbox will change to "B" list, etc.

    Is this possible in VBA?

  2. #2
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    330

    Re: Display different list in a list box when specific drop down chosen

    if A,B and C are named ranges it is easy just use.
    Please Login or Register  to view this content.
    if not you will have to do a match (to find the combobox text on the spreadsheet and use that location to defign the selected range
    Last edited by Leon V (AW); 12-17-2013 at 12:27 PM.

  3. #3
    Registered User
    Join Date
    03-18-2013
    Location
    canada
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Display different list in a list box when specific drop down chosen

    Hi Leon V

    Thanks for your help, and yes, I think in my case, I will need to do a match to pull the list from spreadsheet (sound like easier with this form). What will be the coding suggestion in this case?

    Actually maybe I need to explain a bit more on what I need to do here

    Supply Chain/Delivery -- this is one of the item in dropdown menu, once this select then below show on the listbox
    Delivery Delays
    Driver Experience
    Accuracy of order - misfill
    Accuracy of order - shortship/overship
    Condition of packaging
    Returns - delay in pick up
    Returns - toner recycling

    Pricing -- this is another item from the dropdown menu, if this choose, listbox will show below list instead of the above
    Pre-login
    Post-login
    Contract discrepancy
    Pricing discrepancy
    Vendor pricing increase

    Ideally initial userform when first open, the lisbox is empty.

    Is that somewhat possible?




    Thanks
    Leo (lwwc)
    Last edited by lwwc; 12-17-2013 at 01:01 PM. Reason: add more details to my question

  4. #4
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    330

    Re: Display different list in a list box when specific drop down chosen

    the following assumes that your bold text is column headers
    Please Login or Register  to view this content.
    and this version assumes they are row headers.
    Please Login or Register  to view this content.
    Last edited by Leon V (AW); 12-18-2013 at 05:36 AM.

  5. #5
    Registered User
    Join Date
    03-18-2013
    Location
    canada
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Display different list in a list box when specific drop down chosen

    Thanks again

    Can you explain a bit on
    Set found = Range("1:1").Find(name)
    For Each selected In Range(Cells(2, found.Column).Address, found.End(xlDown).Address).Cells

    As I'm so new that I try to understand this part.

    I tried to place the code to my file but got Run-time error '91': Object variable or With block variable not set

    Should I placed all my list at a certain worksheet / column within the file?

  6. #6
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    330

    Re: Display different list in a list box when specific drop down chosen

    {Set found = Range("1:1").Find(name)} searches row 1 for the combobox selection.
    {For Each selected In Range(Cells(2, found.Column).Address, found.End(xlDown).Address).Cells} starts a loop to go through each cell bellow the found header
    The code should be placed in the userform code module.

    Edit: see attached for example.
    Attached Files Attached Files
    Last edited by Leon V (AW); 12-18-2013 at 05:48 AM.

+ 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. Moving Rows to another Sheet chosen from a drop down list
    By RumaR28 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-25-2013, 07:32 AM
  2. [SOLVED] Suppress drop-down list dependent on value chosen in another drop-down list
    By ptmald in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2013, 07:17 PM
  3. Adding a value depending on Drop-down-list chosen value
    By freaken00 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-23-2013, 05:24 AM
  4. Replies: 22
    Last Post: 06-02-2012, 11:45 AM
  5. [SOLVED] My Excel drop-down list eliminates from list options chosen. Help
    By Sybil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2006, 05:25 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