Searchable filters

Jagat Pavasia

Board Regular
Joined
Mar 9, 2015
Messages
244
Office Version
  1. 2019
Platform
  1. Windows
I have VBA code in my excel sheet. I am not expert in VBA code.
I ask someone for my easy work.

now i have auto filter in my excel sheet from A1 to U1.
Means while i type in this range (A1 to U1) then auto filter are start from A3 to U3.
excel.JPG

but i want searchable filter.
for example, If i type "beauty" then, all data regarding "beauty, beautiful, beastliness" is coming out.

please edit VBA code and help me.

My VBA code is below
VBA Code:
Private Sub worksheet_change(ByVal Target As Range)

Dim rng As Range

  If Target.Count > 1 Then Exit Sub
  Application.EnableEvents = False
  ActiveSheet.Unprotect
  Set rng = Range("B:B,K:K")
  If Not Intersect(Target, rng) Is Nothing Then
    If Target.Value = "**" Then Target.Value = Format(Date, "mm/dd/yyyy")
  End If

  If Not Intersect(Target, Range("A1:U1")) Is Nothing Then
      If Target.Value = "" Then
          ActiveSheet.Range("A3:U3").AutoFilter Field:=Target.Column
      Else
          ActiveSheet.Range("A3:U3").AutoFilter Field:=Target.Column, Operator:=xlFilterValues, Criteria1:=CStr(Target.Value)
      End If
  End If
  ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
        False, AllowFormattingCells:=True, AllowFiltering:=True
  Application.EnableEvents = True
End Sub
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Watch MrExcel Video

Forum statistics

Threads
1,128,107
Messages
5,628,731
Members
416,333
Latest member
Time2Learn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top