Results 1 to 2 of 2

Thread: Filter as i type search bar

  1. #1
    Seeker Engineer22's Avatar
    Join Date
    Jun 2018
    Posts
    8
    Articles
    0
    Excel Version
    2007

    Filter as i type search bar



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Can someone please help me. I need a "filter as i type", search bar. I am super close and as of now the code only searches 1 column, if someone could please edit it to make it search all of my columns that would be amazing.SEARCH BAR help.xlsmSEARCH BAR help.xlsm

  2. #2
    Magician NoS's Avatar
    Join Date
    Jan 2013
    Location
    British Columbia
    Posts
    719
    Articles
    0
    Excel Version
    Excel 2010 64bit
    Perhaps an in place Advanced AutoFilter.

    All headers must be unique.
    Copy the header row to sheet2 row 1
    This uses the sheet code names.
    Code:
    Private Sub TextBox1_Change()
        Dim i As Integer
        
    If Len(TextBox1.Value) = 0 Then
        With Sheet2
            For i = 1 To 16
                .Cells(i + 1, i).Value = ""
            Next i
        End With
        If Sheet1.FilterMode Then Sheet1.ShowAllData
    Else
        With Sheet2
        For i = 1 To 16
            .Cells(i + 1, i).Value = "*" & Sheet1.TextBox1.Value & "*"
        Next i
        End With
        Call AdvancedFilter
    End If
    End Sub
    
    
    Private Sub AdvancedFilter()
        Dim lr As Long, filtrng As Range
    
    lr = Split(Mid(Sheet1.UsedRange.Address, 2), "$")(3)
    Set filtrng = Sheet1.Range("A5:P" & lr)
    filtrng.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Sheet2.Range("A1:P17")
    End Sub
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •