+ Reply to Thread
Results 1 to 3 of 3

filter listbox without rowsource

  1. #1
    Registered User
    Join Date
    06-21-2009
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    Excel 2003, 2007
    Posts
    26

    Question filter listbox without rowsource

    Hi there,

    I'm working on a database and managed to put together a macro that searches the active sheet and presents all matching registrations in a multicolumn listbox. However, the database will eventually contain over a thousand entries, so I'd like to install one or more filters; that is, I'd like a macro to conditionally remove rows from the listbox when the value in the second cilumn does not match the value in another list or textbox. There are several examples of such filters available on the web, but they all seem to be using listboxes filled with the rowsource property, and the listbox in my file is filled using vb (.AddItem, file attached).

    I'd be very happy if anyone would provide me with a code that filters the searchresults in the listbox directly, without transferring data to or from sheets. Thanks in advance.
    Attached Files Attached Files

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

    Re: filter listbox without rowsource

    Maybe using RemoveItem method - see VBA help files
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    06-21-2009
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    Excel 2003, 2007
    Posts
    26

    Re: filter listbox without rowsource

    Quote Originally Posted by royUK View Post
    Maybe using RemoveItem method - see VBA help files
    thanks for your response; the RemoveItem method does seem to be the answer. However, I can't use an If-statement within an If Not/Else block, so how could I make the RemoveItem dependant on the value in column 5?

+ 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