Results 1 to 3 of 3

Filter using Listbox selected item(s)

Threaded View

dgbunny Filter using Listbox selected... 07-07-2016, 12:21 PM
Richard Buttrey Re: Filter using Listbox... 07-07-2016, 12:28 PM
dgbunny Re: Filter using Listbox... 07-11-2016, 09:17 AM
  1. #1
    Registered User
    Join Date
    06-29-2016
    Location
    Louisiana
    MS-Off Ver
    2010
    Posts
    2

    Filter using Listbox selected item(s)

    New to VBA and would greatly appreciate assistance.

    Using Excel 2010 and modifying code found online.

    I have created a userform which contains Listbox populated from another table. Listbox is multiselect.

    I need to filter table to view rows based on user-selected item(s) from Listbox. Here is what does not work....


    Private Sub ProjEngCommand_Click()
    
       Dim Criteria As String
       Dim i As Variant
    
       ' Build criteria string from selected items in list box.
       Criteria = ""
       For Each i In Me![ProjEngFilter].ItemSelected
          If Criteria <> "" Then
             Criteria = Criteria & " OR "
          End If
          Criteria = Criteria & "[ResEng]='" _
           & Me![ProjEngFilter].ItemData(i) & "'"
       Next i
    
       ' Filter the form using selected items in the list box.
       Me.Filter = Criteria
       Me.FilterOn = True
        
    End Sub

    This error message refers to ".Filter" in debug

    Compile error:
    Method or data member not found
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by dgbunny; 07-07-2016 at 03:13 PM. Reason: adding workbook

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Get the name of a listbox where an item is selected
    By Jerbinator in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-22-2016, 03:16 PM
  2. Listbox item Highlighted but not Selected
    By shawnvw in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-17-2015, 05:29 PM
  3. Selected item in first listbox.
    By waka in forum Access Tables & Databases
    Replies: 1
    Last Post: 02-09-2015, 11:45 PM
  4. [SOLVED] Selected Listbox Item to Textbox
    By TheRobsterUK in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2014, 04:07 PM
  5. [SOLVED] Macro to run when item is selected from listbox
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-30-2014, 09:58 PM
  6. [SOLVED] Run 1 macro when any item from listbox is selected
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-30-2014, 09:52 PM
  7. Remove selected item from listbox
    By ChrisMattock in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-28-2014, 08:36 AM

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