Results 1 to 8 of 8

ComboBox Filter, search with partial text improvement

Threaded View

  1. #1
    Registered User
    Join Date
    04-20-2020
    Location
    Netherlands
    MS-Off Ver
    excel 2016
    Posts
    36

    ComboBox Filter, search with partial text improvement

    Hello there,

    I've made a combobox with an filter to search for partial matched values in my database. This is the code i use:
    Private Sub ComboBox1_Change()
    Call OptimizeCode_Begin
     
     Dim myVal As String, i As Long, ii As Long
    
        With Me.ComboBox1
            If .Text = "" Then
                .List = myList
            Else
                myVal = .Text
                For i = .ListCount - 1 To 0 Step -1
                    If Not UCase$(.List(i, 3)) Like "*" & UCase$(myVal) & "*" Then .RemoveItem (i)
                Next
            End If
        End With
    
     Call OptimizeCode_End
     
    End Sub
    There is one problem. When i start typing with the dropdown list expanded, and press a few letters, it does not remove the last item in the list. Now i get a list of matching strings, but there is still one value at the bottum of the list stuck, when its supposed to be deleted. I recon its because you take 1 from the listcount. But without this part, the code does not work.

    It looks like this:

    I would be really gratefull if someone could help me.
    Attached Images Attached Images

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Partial search in combobox with name range
    By frankytheman in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-19-2020, 11:43 PM
  2. Search and Match partial text string to full text and return a value
    By homa5424 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-09-2017, 10:52 AM
  3. Replies: 15
    Last Post: 07-27-2017, 08:18 AM
  4. Filter search with combobox option
    By matt-43 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-26-2016, 05:57 AM
  5. search partial text
    By shaifshahin in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-14-2016, 12:17 PM
  6. Partial text search
    By dawsexcel in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-23-2014, 12:50 PM
  7. Replies: 2
    Last Post: 02-06-2014, 09:52 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