+ Reply to Thread
Results 1 to 2 of 2

i need help on using a combo box to filter data

  1. #1
    Registered User
    Join Date
    03-03-2019
    Location
    United States
    MS-Off Ver
    2016
    Posts
    3

    i need help on using a combo box to filter data

    I created a filter combo box in excel to search data in excel , but when i try to filter it it shows me the filtered number and the complete data list below.
    How can I modify the code so that it only shows the filtered data?.
    Is there also anyway to update the ComboBox info automatically and delete repeated data?
    Thank You.


    This is the code that I am Using:
    Private Sub ComboBox1_Change()
    Dim i As Long
    Dim sFind As String

    sFind = Me.ComboBox1.Text

    If Len(sFind) = 0 ThenMe.ListBox1.ListIndex = -1
    Me.ListBox1.TopIndex = 0
    Else
    For i = 0 To Me.ListBox1.ListCount - 1
    If UCase(Left(Me.ListBox1.List(i), Len(sFind))) = UCase(sFind) Then
    Me.ListBox1.TopIndex = i
    Me.ListBox1.ListIndex = i
    Exit For
    End If
    Next i
    End If

    End Sub

    I am also sending an attachment of the excel file , it is located at developer, visual basic
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,943

    Re: i need help on using a combo box to filter data

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Need to tie combo box selection to drive a data filter
    By dlbarr1954 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 06-06-2017, 08:40 PM
  2. [SOLVED] combo box, data filter
    By ddesantis in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-28-2014, 06:21 PM
  3. combo box to filter data in excel
    By help2 in forum Excel General
    Replies: 0
    Last Post: 03-18-2013, 07:43 PM
  4. [SOLVED] Filter data by using dependent combo boxes
    By stewfeed in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-28-2013, 01:13 AM
  5. Filter Data with combo boxes
    By hockeyadc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-12-2012, 01:51 PM
  6. Create a combo box to filter & display data
    By Bandicoot in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-06-2012, 11:57 AM
  7. Filter data using Combo Boxes
    By gsrai31 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-28-2007, 04:16 AM

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