I busted my head and couldn't figure out why I'm getting the this error...
ActiveSheet.ListObjects("Tabela6").Range.AutoFilter Field:=164, Criteria1:= _
"Não"
With Worksheets("Thundera").AutoFilter.Range
Range("FH" & .Offset(1, 0).SpecialCells(xlCellTypeVisible)(1).Row).EntireRow.Select
End With
Range(Selection, Selection.End(xlDown)).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.EntireRow.Delete
ActiveSheet.ShowAllData
I really am in a dead end... Any help is greatly appreciated! Thanks!
CodePudding user response:
Please, try using the next way(s). I asked about what you really need deleting but you did not answer... So I prepared an answer for both possibilities:
- The next code deletes the TABLE rows:
Sub DeleteTableRows()
Dim tbl As ListObject
Set tbl = ActiveSheet.ListObjects("Tabela6")
tbl.Range.AutoFilter field:=164, Criteria1:="Não"
Application.DisplayAlerts = False
tbl.DataBodyRange.SpecialCells(xlCellTypeVisible).Delete
Application.DisplayAlerts = True
End Sub
- This one deletes the SHEET rows by TABLE visible cells:
Sub DeleteSheetRows()
Dim tbl As ListObject
Set tbl = ActiveSheet.ListObjects("Tabela6")
tbl.Range.AutoFilter field:=164, Criteria1:="Não"
Application.DisplayAlerts = False
tbl.DataBodyRange.SpecialCells(xlCellTypeVisible).rows.Delete
Application.DisplayAlerts = True
End Sub