I've been trying to filter for 5 values in column O. These values may or may not exist. What I've been trying are the two following examples:
ActiveSheet.ListObjects("Sheet1").Range.AutoFilter Field:=15, Criteria1:= _
Array("CONS", "MISC", "PFG", "PRT", "TOTE"), _
Operator:=xlFilterValues
ActiveSheet.Range("$O$8:$O").SpecialCells(xlCellTypeVisible).EntireRow.DELETE
Range("O8").AutoFilter Field:=15
and
ActiveSheet.Range("$O$8:$O").AutoFilter Field:=15, Criteria1:="=CONS", _
Operator:=xlOr, Criteria2:="=MISC", _
Operator:=xlOr, Criteria3:="=PFG", _
Operator:=xlOr, Criteria4:="=PRT", _
Operator:=xlOr, Criteria5:="=TOTE"
ActiveSheet.Range("$O$8:$O").SpecialCells(xlCellTypeVisible).EntireRow.DELETE
Range("O8").AutoFilter Field:=15
The first block of code gives me the error: Subscript out of range. The second gives the error: Application-defined or object-defined error.
Does anyone see what's wrong with these?
Thank you.
Try