Hello all. The second code set is based this thread:
though I've tried other suggstions and get the same result. An error on line 26.
Arggg . . . ideas
TIA
Ron
HTML:
https://www.mrexcel.com/forum/excel-questions/553208-vba-filter-delete.html
Arggg . . . ideas
TIA
Ron
Code:
1 Sub A5_tm_Filter() 2 'Application.DisplayAlerts = False
3 'Application.DisplayStatusBar = False
4 'Application.ScreenUpdating = False
5'
6 Dim thiswb As Workbook
7 Dim thisws As Worksheet
8 Dim LastRow As Long
9 Dim lastCol As Integer
10 Dim rng As Range
11'
12 Set thiswb = ActiveWorkbook
13 Set thisws = ActiveSheet
14 '
15 LastRow = Cells(Cells.Rows.Count, "F").End(xlUp).Row
16 lastCol = Cells(1, Columns.Count).End(xlToLeft).Column
17 '
18 If ActiveSheet.FilterMode = True Then
19 ActiveSheet.ShowAllData
20 End If
21'
22 Range("A1").Activate
23 With Range("A1", Cells(LastRow, lastCol))
24 If ActiveSheet.AutoFilterMode Then ActiveSheet.AutoFilter.Range.AutoFilter
25 .AutoFilter field:=2, Criteria1:="="
26 Range("A2" & Cells(LastRow, lastCol)).SpecialCells(xlCellTypeVisible).EntireRow.Delete
27 .AutoFilter
28 End With
29 End Sub