-
Using a variable to as criteria in autofilter
Hi, hope someone out there can help.
I am trying to run the code below but keep getting a runtime error code 1004 - Application-defined or object-defined error.
ActiveSheet.Range("$A$:$Q").AutoFilter Field:=15, Criteria1:= _
MyCell, Operator:=xlFilterValues
I declared MyCell as a Range and want to use it as a filter criteria in my data A$:Q$.
Any help will be much appreciated.
-
[vba]
with ActiveSheet.usedrange.resize(,17)
.AutoFilter 15, MyCell.value
end with
[/vba]
-
Works perfect.
Many thanks snb, made my day!
-
Too much honour, your Honour.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules