Dear
Nikhil Patki
Thanks for sharing your dataset. I have modified my previous code in such a way that you can use it in your workbook.
Likewise, paste the following code into the sheet (
Data) module and save the workbook.
Sub-procedure & Event Procedure:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet
Dim changedCell As Range
Set ws = ThisWorkbook.Sheets("Data")
Set changedCell = ws.Range("J2")
If Not Intersect(Target, changedCell) Is Nothing Then
Call ApplyAdvancedFilter
End If
End Sub
Sub ApplyAdvancedFilter()
Dim ws As Worksheet
Dim dataRange As Range
Dim criteriaRange As Range
Dim filteredRange As Range
Dim lastRow As Long
Set ws = ThisWorkbook.Sheets("Data")
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
Set dataRange = ws.Range("A1:F" & lastRow)
Set criteriaRange = ws.Range("J1:J2")
If ws.Cells(ws.Rows.Count, "J").End(xlUp).Row > 2 Then
ws.Range("J4:O" & ws.Cells(ws.Rows.Count, "J").End(xlUp).Row).Borders.LineStyle = xlNone
ws.Range("J4:O" & ws.Cells(ws.Rows.Count, "J").End(xlUp).Row).ClearContents
End If
Set filteredRange = ws.Range("J4")
dataRange.AdvancedFilter Action:=xlFilterCopy, criteriaRange:=criteriaRange, CopyToRange:=filteredRange, Unique:=False
End Sub
And if you are searching for
Delte executor Android you can check our official site of delta executor.
OUTPUT:
Hopefully, the idea will help you. Good luck.
Regards
Lutfor Rahman Shimanto