+ Reply to Thread
Results 1 to 2 of 2

display data based on a combobox

  1. #1

    display data based on a combobox

    Hi

    I have a table full with data (name, date, quantity, amount, etc...) on
    sheet2

    In sheet1, I have a combobox with all of the names on the table and I
    need to know how to display automatically the data from sheet2 for only
    the name I select from the combobox in sheet1.

    I was thinking sending the value of the combobox to a cell and making a
    vlookup for that value on sheet2, but I only get the first value.

    Please help

    Thanks

    Daniel


  2. #2
    Toppers
    Guest

    RE: display data based on a combobox

    Daniel,
    One option is to use MATCH to find the name (and hence row) in
    sheet2 and then read the data into an array

    Assume data is in columns A to H with A containing name.

    Dim Data as variant
    Dim ws2 as worksheet

    set ws2=worksheets("sheet2")

    Myname=Worksheets("sheet1").range("a5") ' <=== your Combobox selection

    row = Application.Match(MyName, ws2.Range("A:A"), 0)

    If Not IsError(row) Then ' <==== match found

    Data = ws2.Range("B" & row & ":H" & row) ' Read data into array

    For r = LBound(Data, 1) To UBound(Data, 1)
    For c = LBound(Data, 2) To UBound(Data, 2)
    Debug.Print Data(r, c)
    ' ... Assign to cells in Sheet1
    Next c
    Next r
    End If


    HTH

    "[email protected]" wrote:

    > Hi
    >
    > I have a table full with data (name, date, quantity, amount, etc...) on
    > sheet2
    >
    > In sheet1, I have a combobox with all of the names on the table and I
    > need to know how to display automatically the data from sheet2 for only
    > the name I select from the combobox in sheet1.
    >
    > I was thinking sending the value of the combobox to a cell and making a
    > vlookup for that value on sheet2, but I only get the first value.
    >
    > Please help
    >
    > Thanks
    >
    > Daniel
    >
    >


+ 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