Consulting

Results 1 to 3 of 3

Thread: Listbox and name manager comparison

  1. #1
    VBAX Newbie
    Joined
    May 2020
    Posts
    2
    Location

    Listbox and name manager comparison

    Hello,


    this is my first mail, and I'm a total beginner. So if the question has been asked somewhere, I apologize in advance.


    I have created a ListBox (Listbox1) in userform and put the name manager as source in it.
    Depending on which list entry is selected, the entries of other ListBoxes change (quasi sublists also as name manager).
    In the next step I would like to program the whole thing in such a way that if the selected sub-list combination is also present in another part of the main list box, then these others are displayed. Unfortunately I am missing any approach.
    How can I compare the content of a ListBox with my list (from the name manager) ? Thank you very much.


    This is my code yet.


    Private Sub ListBox1_Click()
     Dim x As Integer
    x = ListBox1.ListIndex
     Select Case x
        Case Is = 0
        ListBox2.RowSource = "Verfahren1"
        ListBox3.RowSource = "Toleranz1"
        ListBox4.RowSource = "Rautiefe1"
        Case Is = 1
        ListBox2.RowSource = "Verfahren2"
        ListBox3.RowSource = "Toleranz2"
        ListBox4.RowSource = "Rautiefe2"
        Case Is = 2
        ListBox2.RowSource = "Verfahren3"
        ListBox3.RowSource = "Toleranz3"
        ListBox4.RowSource = "Rautiefe3"
     End Select
    End Sub
    Last edited by Aussiebear; 06-12-2020 at 09:27 PM. Reason: Added code tags

  2. #2
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    Don't use .Rowsource to populate a combobox/listbox

    Private Sub ListBox1_Click()
       with Tabelle1.range("A1:A10")
           ListBox2.List = .offset(,ListBox1.ListIndex)
           ListBox3.List = .offset(15,ListBox1.ListIndex)
           ListBox4.List = .offset(30,ListBox1.ListIndex)
       End With
    End Sub

  3. #3
    VBAX Newbie
    Joined
    May 2020
    Posts
    2
    Location
    Why ?
    Where is the difference between this 2 solutions?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •