+ Reply to Thread
Results 1 to 10 of 10

Listbox filter and display issues

  1. #1
    Registered User
    Join Date
    01-27-2010
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Listbox filter and display issues

    I think I might have gotten a little bit over my head with a project for work. I’m working on a Userform that pulls from an excel sheet with 35 columns. some of the rows in the column have very similar information, with the exception of 5-7 different cells.
    The first thing I was trying to do is be able to filter out the rows that are similar using a listbox and a combobox. In the Combobox, you would input the number in the cell that you are looking for. The userform would then autofilter the results into the listbox.
    The next thing I wanted to do is, once you click on one of the results in the listbox, it then shows you all of the data from that specific row.
    The first attempt filtered the rows into the listbox, but when I clicked on one of the results, it would always show me Row 1, even if the information I wanted was row 23. The code is listed below.
    Please Login or Register  to view this content.
    The second attempt, I used an offset code to have the data pull from the lisbox instead of the spreadsheet, but found that I could only have 9 columns in the listbox, which will not populate the 34 fields that I need to populate. I will post up the second part of code seperately as all of it's too long to fit into one post

    I really need help with this as I’m completely stuck. Is this something that just cannot be done, or am I just missing something REALLY important???
    Last edited by brouhaha501; 06-14-2010 at 08:11 AM.

  2. #2
    Registered User
    Join Date
    01-27-2010
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Listbox filter and display issues

    here is the second part:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-27-2010
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Listbox filter and display issues

    bump - no response

  4. #4
    Registered User
    Join Date
    01-27-2010
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Exclamation Re: Listbox filter and display issues

    I apologize if the description above is a bit too much, or may not make sense, so i will attempt to clarify.

    I have a worksheet where one person on the list may have multiple rows of data. I am trying to create a userform to first search all claims with ther persons reference number, and display all rows of data in a listbox.

    Then, when one of the items in the listbox is clicked, i would like to have multiple textboxes fill with the data from that specific row.

    I first attempted used a combobox where you can type in the reference number you were looking for, then it would populate the listbox with the correct results. but, when you clicked on one of the items in the listbox, it would not populate the row that you wanted to see. Instead, it populates the first row of data on the worksheet, and go down from there (i.e 1st, 2nd, 3rd ect).

    My second attempt I used RoyUK's example found on http://www.excel-it.com/vba_examples.htm and tried to tweak it to fit this worksheet. It works excellant, with the exception tha the textboxes fill from the listbox, and only 9 columns can go in a listbox. both of the coding is posted higher up on this same thread.

    I'm in a VERY bad way right now as I really need to solve this problem soon for work. Any and all help is appreciated more than I can put into words. Please please please, if you could help!!!

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Listbox filter and display issues

    A sample workbook would help a lot, I think.
    Remember what the dormouse said
    Feed your head

  6. #6
    Registered User
    Join Date
    01-27-2010
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Listbox filter and display issues

    I have attached the two different examples.
    Attached Files Attached Files

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Listbox filter and display issues

    Try this one. I've tidied up and simplified some of the code.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-27-2010
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Listbox filter and display issues

    Thank you so much for helping out!! I'm still having an issue though:

    When i type in a reference number into the combobox (userfilter), the listbox shows all of the filtered results of all of the rows with the specified info in it. but when i click on one of the items in the listbox, the textboxes to the right will populate from the first row in the sheet.

    For instance - if you type in the reference number 5886410 into the combobox, the listbox will show two dates, one for each row that has the reference number in it. but when you click on the top date (02/02/2010) it will reference the very top row for Brendan Brendan instead of test sixteen, which is who the reference number is for.

    I think what's happening is the code for the listbox is pulling from the sheet as a whole instead of pulling the information from that particular row, but i have no clue how to fix it.

    Romper, thanks so much again for all of your help. it's really been awesome of you to take a look at this for me, and i do appreciate you taking the time to lock down the coding.

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Listbox filter and display issues

    Try this one. It stores the row numbers in a hidden column in the listbox so that you can then retrieve them directly.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    01-27-2010
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Listbox filter and display issues

    You ARE AWESOME!!!! thanks so much. it does EXACTLY what i need it to do!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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