Display data in userform from spreadsheet

  • Hello there,



    So I have a userform with TextBox1, the user will manually write a number and I need to display data related to that number in the same userform right after the number is written.



    I would like to have that appear in a label right below the textbox so that it doesn't seem editable



    So, the number would have to be searched in sheet2, column A and needs to pull data from column B (date), C (action)and D (quantity), the thing is that it will appear in about 4 or 5 rows, so I need each row to be displayed, something like this:



    06/10/2016 operation-A 10,000
    06/11/2016 operation-B 5,000
    06/12/2016 operation-B 5,000
    06/12/2016 operation-C 5,000
    etc...



    I'd really appreciate your help with this,



    Regards!

  • Re: Display data in userform from spreadsheet


    thanks, I have created a simplified version of what I'm doing, just to focus on the lesson, I've placed labels in the userform explaining what i need to show


    thanks!

  • Re: Display data in userform from spreadsheet


    I would use a ComboBox to select the number from, this removes the chance of a user inputting an incorrect number.

  • Re: Display data in userform from spreadsheet


    [/CODE]

    Quote from royUK;772595

    I would use a ComboBox to select the number from, this removes the chance of a user inputting an incorrect number.


    Thanks a lot Roy,


    well the problem is that the real list will have hundreds of numbers, it would be slower to find it in a combobox than just typing it, actually that's why I need the description in the label, so that they check if they typed correctly,


    so, I tried to figure out how to transform this from using the CmbOrder data into the OrderTextBox data but just can't figure it out, I tried changing (Me.CmbOrder.ListIndex +4,2).value by (OrderTextBox.value +4,2).value but didn't work, could you help me one more time with it?



    Code
    1. Private Sub CmbOrder_Change() With Me
    2. .Label4.Caption = Sheet4.Cells(Me.CmbOrder.ListIndex + 4, 2).Value
    3. .Label5.Caption = Sheet4.Cells(Me.CmbOrder.ListIndex + 4, 3).Value
    4. End With
    5. End Sub