+ Reply to Thread
Results 1 to 11 of 11

listbox vs filter

  1. #1
    Registered User
    Join Date
    05-24-2011
    Location
    montreal
    MS-Off Ver
    Excel 2003
    Posts
    11

    listbox vs filter

    Hi folks,

    I have a userform containing a listbox. In this listbox, theres data imported from a column ("vendor list") in a big spreadsheet.
    What i need to do is to give the user the capability to filter the big spreadsheet by selecting lines in the listbox.

    The listbox has to act like a filter for the column "vendor list". By filtering that column the user will see the rows corresponding to his selection n the big spreadsheet.


    Can anybody help me with this. I assume its a small vba code.

    Thanks to the Gurus

  2. #2
    Registered User
    Join Date
    06-07-2011
    Location
    Raleigh, Nc
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: listbox vs filter

    I am not too certain about list boxes, but I do know that with a combo box (drop down box), vba has code section for combo box change. you could populate that combo box with the data you would need to filter the rows, and then just use the combobox.value tag to pull the value with which to filter your columns.

    hope this helps!

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: listbox vs filter

    Maybe this

    FilterForm.zip
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: listbox vs filter

    ahmad123,

    I know royUK beat me to it, but I made a sample book also

    Hope this helps,
    ~tigeravatar
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-24-2011
    Location
    montreal
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: listbox vs filter

    thx alot guys, i appreciate the help. But in my case i need to be able to choose more then one option from the listbox.

    is it possible ???

    thx again

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: listbox vs filter

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

  7. #7
    Registered User
    Join Date
    05-24-2011
    Location
    montreal
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: listbox vs filter

    guys, in the attached file they're my file and my code behind.

    In sheet2 u will find the button that has to create a listbox, but the problem is when i select options in this listbox, nothing happens !!!

    And can u please modify the code so i will be able to make multi selections in the listbox ???

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: listbox vs filter

    Which file?

  9. #9
    Registered User
    Join Date
    05-24-2011
    Location
    montreal
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: listbox vs filter

    this is the file
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    05-24-2011
    Location
    montreal
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: listbox vs filter

    Can i get an input here please Roy ???

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: listbox vs filter

    The Autofilter code can be adapted from my example, but I really can't see any need for what you want. Just use AutoFilter on the sheet.

+ 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