VBA Overflow problem when filtering
Posted on 2016-10-20
I am doing a filter to find all of the items with ‘Credit’ then I want to delete these items. The below works fine when there are items in there with ‘Credit in column I. However if there are no items I get ‘Overflow’
Can an expert provide the solution so that if there are no items in column with ‘Credit’ the macro moves on to the next part of the code.
With Range("I1:I" & Cells(Rows.Count, "I").End(xlUp).Row)
.AutoFilter 9, "=CREDIT"
If .SpecialCells(xlCellTypeVisible).Count > 1 Then
.Resize(.Rows.Count - 1).Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.Delete
Thanks in advance