What I want to do with VBA - filter table with array and delete rows. My array has 4 elements (changed in a loop to have 5 different sets). Column which is being filtered has 5 elements. I want to get just 1. This is inside a loop which will create 5 reports, each filtered for different element based on column 29.
If in debugging mode I filter that column manually and skip that line I have second, identical error 5 lines below when trying to clear all filters back again.
This are lines 765 and 770 out of part of 788. Everything else runs smoothly.
FilterOutArray - array with 4 elements (Variant/String each). Column 29 has 5 different values, no blanks
I've tried to refer "Criteria1" with string, to see if filtering one elements works, but not.
'Run-time error: '1004' on row below
ActiveSheet.Range(Cells(1, 1).Cells(29, LastRow)).AutoFilter Field:=29, Criteria1:=FilterOutArray, Operator:=xlFilterValues
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
'Run-time error: '1004' on row below
ActiveSheet.Range(Cells(1, 1).Cells(29, 9999)).AutoFilter Field:=29