Hi,
I'm having problems trying to filter my data set. Each time I try to use the range.autofilter option, I get the Run-time error '1004': Application-defined or object-defined error.
Please find a part of my code below
With wbDest.Sheets("RSPS5")
.Activate
LastRowDest = .Range("B" & Rows.Count).End(xlUp).Row
End With
wbDest.Sheets("RSPS5").Range("B4:DX" & LastRowDest).AutoFilter Field:=20, Criteria1:="CLOSED", Header:=xlYes
With wbDest.Sheets("RSPS5")
.Range("U7:U" & LastRowDest).SpecialCells(xlCellTypeVisible).EntireRow.Delete
LastRowDest = .Range("B" & Rows.Count).End(xlUp).Row
End With
wbDest.Sheets("RSPS5").Range("B4:DX" & LastRowDest).AutoFilter Field:=20
wbDest has been defined earlier in the macro and is working properly for the code before this part.
The column I want to filter on is 'U' (and should be the 20th column if you start counting from column 'B').
What I have tried:
There is some redundant code. I've been trying several ways to make it work by explicitly adding workbooks and worksheets in front of the filter lines.
The odd part is that, while debugging, I can see that the workbook, worksheet and range is defined.
I can manually filter on lines containing "CLOSED" text so that shouldn't be an issue either, in my inexperienced opinion.
I'm probably overlooking something, so if anybody could point me in the right direction, I'd be super thrilled.