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"
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.