Posts by pooky

    Hi, again!
    I have managed to put together excel userform for looking up data in excel!
    I have created a listbox (two of them) which are filled up in two columns when the criteria meets!
    But when I`m testing this thing the error mismatch pops up ( Could not set the List property. Type mismatch. Run-time error `-2147352571 (80020005)` , what does my code is missing??!?!


    Here is the code:



    &


    MODERATOR NOTE: please remember to use code tags in future as per forum rules.

    This is my first thread here.... so please if you can, don`t be harsh... :)
    There is the thing, I am trying to build a UserForm just for "simple" search.
    At the moment I have two worksheets - "Dati"; "kilas"
    In both ws the lookup value is in col A.


    What I did already,
    User will put a Client ID number in search textbox called: "krednr"
    Based on this criteria it retrives data to all other textboxes form different colums
    It goes for ws "Dati" and "kilas"


    This is what I have:


    Private Sub CommandButton1_Click()
    row_number = 0
    Do
    DoEvents
    row_number = row_number + 1
    item_in_review = Sheets("Dati").Range("A" & row_number)
    If item_in_review = krednr.Text Then
    TextBox1.Text = Sheets("Dati").Range("G" & row_number)
    TextBox3.Text = Sheets("Dati").Range("H" & row_number)
    TextBox4.Text = Sheets("Dati").Range("J" & row_number)
    TextBox5.Text = Sheets("Dati").Range("F" & row_number)
    TextBox6.Text = Sheets("Dati").Range("R" & row_number)
    TextBox7.Text = Sheets("Dati").Range("M" & row_number)
    TextBox8.Text = Sheets("Dati").Range("N" & row_number)
    TextBox9.Text = Sheets("Dati").Range("AI" & row_number)
    End If
    Loop Until item_in_review = ""
    row_number = 0
    Do
    DoEvents
    row_number = row_number + 1
    item_in_review = Sheets("kilas").Range("A" & row_number)
    If item_in_review = krednr.Text Then
    TextBox10.Text = Sheets("kilas").Range("D" & row_number)
    End If
    Loop Until item_in_review = ""

    End Sub



    But today I spent 4hours trying to find solution for cases when there is a multiple records for one client ID
    I need them to show in one text box or listbox....


    Example:




    [TABLE="class: grid, width: 500"]

    [tr]


    [td]

    A

    [/td]


    [td]

    B

    [/td]


    [td]

    C

    [/td]


    [/tr]


    [tr]


    [td]

    Client ID

    [/td]


    [td]

    Pet

    [/td]


    [td]

    Count

    [/td]


    [/tr]


    [tr]


    [td]

    123

    [/td]


    [td]

    cat

    [/td]


    [td]

    1

    [/td]


    [/tr]


    [tr]


    [td]

    177

    [/td]


    [td]

    dog

    [/td]


    [td]

    1

    [/td]


    [/tr]


    [tr]


    [td]

    185

    [/td]


    [td]

    lion

    [/td]


    [td]

    1

    [/td]


    [/tr]


    [tr]


    [td]

    123

    [/td]


    [td]

    dog

    [/td]


    [td]

    2

    [/td]


    [/tr]


    [tr]


    [td]

    123

    [/td]


    [td]

    puma

    [/td]


    [td]

    1

    [/td]


    [/tr]


    [/TABLE]


    Like for examp.:
    If i insert Client ID "123"
    It will show result
    cat 1
    dog 2
    puma 1


    And all in one "BOX"!


    Where should i start?!