Try below code ...
Sub aa_test()
Dim ws As Worksheet, Rg As Range
Set ws = Sheets("Data")
Set Rg = ws.[K1:M2]
For x = 1 To 6
Select Case x
Case 1: Rg = [{"Category","Deliverd";"Free Service","Deliverd";"",""}]
Case 2: Rg = [{"Category","Deliverd";"Repairing","Deliverd";"",""}]
Case 3: Rg = [{"Category","Status","Deliverd";"Free Service","Ok","="}]
Case 4: Rg = [{"Category","Status","Deliverd";"Free Service","=","="}]
Case 5: Rg = [{"Category","Status","Deliverd";"Repairing","Ok","="}]
Case 6: Rg = [{"Category","Status","Deliverd";"Repairing","=","="}]
End Select
If x <= 2 Then
ws.[A1].CurrentRegion.AdvancedFilter 2, Rg.Resize(2, 2), Sheets.Add(, Sheets(Sheets.Count)).[A1]
Else
ws.[A1].CurrentRegion.AdvancedFilter 2, Rg, ws.Range("A" & Rows.Count).End(3)(5)
End If
Next
Rg.Clear
ws.ListObjects(1).Delete
ws.[A1].Resize(ws.[A1].End(xlDown).Row - 1, 9).Delete xlShiftUp
End Sub
Bookmarks