Question: My code below works to delete the SAME data dump.

I want to make it work for varying sizes of data. I just need to filter for Column A where cell = 2 and while that is filtered, filter Column AS for all numbers that are 11 AND Greater.

I cant figure out how to input that into the "criterial:=Array(\_) portion: View my working code below for a sample static dataset:

---

```
Rows("1:1").Select
    Selection.AutoFilter
    Range("A2").Select
    ActiveSheet.Range("$A$1:$JS$15900").AutoFilter Field:=1, Criteria1:="2"
    ActiveWindow.SmallScroll ToRight:=17
    ActiveSheet.Range("$A$1:$JS$15900").AutoFilter Field:=45, Criteria1:=Array( _
        "11", "12", "13", "14", "999"), Operator:=xlFilterValues
    Range("A2310").Select
    Range(Selection, Selection.End(xlDown)).Select
    Range("A2310:AU15724").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.EntireRow.Delete
    Range("A15476").Select
    ActiveSheet.ShowAllData
    Rows("1:1").Select

```

---

Many thanks!

Answer: 
This will use `ActiveSheet`

* If col `A` contains cells with values `= 2` it will AutoFilter it: `Col A = 2`,
* If col `AS` contains cells with values `> 10` it will AutoFilter it: `Col AS > 10`
* Delete all remaining visible rows starting with `START_DEL_ROW`

---

```
Option Explicit

Public Sub FilterAndDelete()
    Const Col1 = 1              'A
    Const Col2 = 45             'AS
    Const Col1_COND = 2         'A criteria
    Const Col2_COND = ">10"     'AS criteria
    Const START_DEL_ROW = 11    'First deleted visible row (to last used row)

    Dim ws As Worksheet, lr As Long, ur As Range, vis As Range, keep As Range

    Set ws = ActiveSheet
    lr = ws.Cells(ws.Rows.Count, Col1).End(xlUp).Row
    Set ur = ws.Range(ws.Cells(1, Col1), ws.Cells(lr, Col2))

    'If col A has cells with val 2
    If WorksheetFunction.CountIf(ur.Columns(Col1), Col1_COND) > 0 Then
        Application.ScreenUpdating = False
        ur.AutoFilter Field:=Col1, Criteria1:=Col1_COND     'Filter col A
        Set vis = ur.SpecialCells(xlCellTypeVisible)

        'If col AS has cells with val > 10
        If WorksheetFunction.CountIf(vis.Columns(Col2), Col2_COND) > 0 Then
            vis.AutoFilter Field:=Col2, Criteria1:=Col2_COND, Operator:=xlAnd
            Set keep = ur.Range(ur.Cells(1, Col1), ur.Cells(START_DEL_ROW - 1, Col1))
            keep.Rows.Hidden = True 'Delete all visible rows (except topof START_DEL_ROW)
            If CBool(Application.Subtotal(103, ur.Cells)) Then
                ur.SpecialCells(xlCellTypeVisible).EntireRow.Delete
            End If
            keep.Rows.Hidden = False
        End If
        ur.AutoFilter
        Application.ScreenUpdating = True
    End If
End Sub

```
you could use this

```
    With Intersect(ActiveSheet.UsedRange, Range("A:AS")) ' reference its columns A:AS range
        .AutoFilter Field:=1, Criteria1:="2"  ' filter referenced range column 1 cells with "2"
        .AutoFilter Field:=.Columns.Count, Criteria1:=">11"  ' filter referenced range last column with ">11"
        If Application.WorksheetFunction.Subtotal(103, .Resize(, 1)) > 1 Then .Resize(.Rows.Count - 1).Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.Delete 'if any filtered cells other than delete their entire row
    End With
    ActiveSheet.AutoFilterMode = False ' remove autofilter

```