1

On Excel spreadsheet I want to filter out rows which have TRUE in column J. Running line below works, but only for that specific range - A5:J38:

ActiveSheet.Range("$A$5:$J$38").AutoFilter Field:=10, Criteria1:="FALSE"

Need for the range to adjust automatically to include rows which have a result in formula displayed in column J (it's either TRUE or FALSE). Code below gives "Run-time error '1004': Application-defined or object-defined error"

ActiveSheet.Range(Rows.Count, 10).End(xlUp).AutoFilter Field:=10, Criteria1:="FALSE"
Alex
  • 55
  • 2
  • 13
  • 3
    `ActiveSheet.UsedRange.AutoFilter Field:=10, Criteria1:="FALSE"` – StoneGiant Nov 12 '18 at 18:22
  • I was afraid that might not work, because my first row, where my filters are, is row 5, and I have other things, which I don't want filtered, in first five rows, but I tried and it works. Thanks! – Alex Nov 12 '18 at 18:30

1 Answers1

1

I believe you just need to make a small edit:

With ActiveSheet
    lastRow = .Cells(.Rows.Count, 10).End(xlUp).Row
    .Range("A5:J" & lastRow).AutoFilter Field:=10, Criteria1:="FALSE"
End With
Kubie
  • 1,551
  • 3
  • 12
  • 23