Jagat Pavasia
Active Member
- Joined
- Mar 9, 2015
- Messages
- 397
- Office Version
- 2021
- Platform
- Windows
Dear sir,
I have Excel Sheet as Image.
I have add VBA code Below :
Now all this working as it should, but I want that if I enter "DTC" in E1 then auto filter all match word in E3:E1000,
another example : If I enter "3/1" then auto filter fin E3:E1000
I have Excel Sheet as Image.
I have add VBA code 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,L:L")
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
Now all this working as it should, but I want that if I enter "DTC" in E1 then auto filter all match word in E3:E1000,
another example : If I enter "3/1" then auto filter fin E3:E1000