Guys,
I am getting an error Run-time error 91: Object variable or With Block variable not set. Can you guys help me fix the error to make this code work. The code just needs to Delete the visible rows and then clear the existing filter to display the results after the deletion.
I appreciate your help!
![]()
Sub DeleteRows() ' Dim lastrow As Range Sheets("TEST").Select lastrow = Range("A" & Rows.Count).End(xlUp).Row 'Delete Visible Rows Range("A5:O" & lastrow).SpecialCells(xlCellTypeVisible).EntireRow.Delete 'Clear Filter With Sheets("TEST") If .FilterMode Then .ShowAllData End With End Sub
Bookmarks