I had trouble posting back yesterday.
I would actually automate AutoFilter to do this. Dave has an example in his workbook, but it needs some changes.
The button won't work because there is no data to filter on the page containing the button. The sheet to work with needs referring to in the code. Also, ScreenUpdating needs switching back on at the end, I usually add an error handler to make sure.
Sub DeleteRwsWithAutoFilter()
With Sheet2
'by Dave Morrison
On Error GoTo err_exit
'timer not really necessary
' .Range("K1") = Format(Now, "h:mm:ss.0000")
Application.ScreenUpdating = False
.Range("A1").AutoFilter Field:=1, Criteria1:="a"
'delete visible Rows, this is where an error could occur
'using Specialcells will error if no Specialcells are found
.Range("A1").CurrentRegion.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.Range("A1").AutoFilter
.Range("L1") = Format(Now, "h:mm:ss.0000")
' .Range("M1") = Format(Range("L1") - Range("K1"), "h:mm:ss.0000")
err_exit:
On Error GoTo 0
Application.ScreenUpdating = False
End With
End Sub
Bookmarks