I am using VB to delete rows meeting certain criteria - however, if the criteria is NOT met, I'm receiving a Run-time 1004 - No cells were found.
The code below will result in a match on Criteria 1, but there is no match on Criteria 2 (often, that is...).
In the event that this occurs, I would like to simply SHOW ALL DATA and move on.
But, as the code is basically telling it to do something that can't be done (at least as I've written it...), it errors out.
The code below will result in a match on Criteria 1, but there is no match on Criteria 2 (often, that is...).
In the event that this occurs, I would like to simply SHOW ALL DATA and move on.
But, as the code is basically telling it to do something that can't be done (at least as I've written it...), it errors out.
Code:
'Set the RANGE and FILTERING CRITERIA.
ActiveSheet.Range("$A$1:$ZZ" & Last_Row_ColA).AutoFilter Field:=41, Criteria1:= _
"EXC"
'Set the RANGE and FILTERING CRITERIA.
ActiveSheet.Range("$A$1:$ZZ" & Last_Row_ColA).AutoFilter Field:=9, Criteria1:= _
"Discontinued"
'Set the RANGE - DELETE all VISIBLE CELLS.
'ActiveSheet.Range("$A$2:$ZZ" & Last_Row_ColA).SpecialCells(xlCellTypeVisible).Select
'DELETE the ROWS.
'Selection.Delete shift:=xlUp