+ Reply to Thread
Results 1 to 9 of 9

Userform Listbox Conditional on Previous Selection

Hybrid View

  1. #1
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Userform Listbox Conditional on Previous Selection

    Try replacing your code with this & see if it is what you want
    Private Sub cmdOK_Click()
        Dim ws As Worksheet
        Set ws = Worksheets("Output")
        ws.Cells(1, 1).Value = Me.listMNGR.Value
        Unload Me
    End Sub
    
    Private Sub listMNGR_Click()
        Dim lCol As Long
        lCol = Me.listMNGR.ListIndex + 4
        With ThisWorkbook.Sheets("combolists")
            output1.listMC.List = .Range(.Cells(2, lCol), .Cells(2, lCol).End(xlDown)).Value
        End With
        Me.Hide
        output1.Show
    End Sub
    
    
    Private Sub UserForm_Initialize()
    
        Dim cell As Range
        With ThisWorkbook.Sheets("combolists")
            listMNGR.List = .Range(.Cells(2, 1), .Cells(2, 1).End(xlDown)).Value
        End With
    End Sub
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  2. #2
    Registered User
    Join Date
    05-23-2011
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    79

    Exclamation Re: Userform Listbox Conditional on Previous Selection

    Thanks but the code does not populate the second list box (blank)

    Its not exactly what i need to do. So first, I would like the trigger to remain on the cmdOK button, instead of the listMNGR_Click.

    Also, I would like it to pull the corresponding list for the second list box depending on the first list box value chosen. I have updated the example sheet with more lists to choose from. I am assuming this will require some sort of indirect/dynamic syntax to reference the correct column, as it will change according the the selection in the first box. For the time being, I would like to retrieve the "MC" list for each name, not the "CG"
    Attached Files Attached Files

+ 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