当我运行以下代码(旨在过滤表然后删除被过滤的行)时,我收到运行时错误“ 5”。当我单步执行宏时,不会出现此错误。仅在运行时。
Sub delete()
Rng.AutoFilter Field:=8, Criteria1:=Array( _
"ROCKFORD DSC", "MATTESON PLANT", "WHEELING PLANT"), _
Operator:=xlFilterValues
Rng.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
End Sub