Filter in macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I'm trying to filter a table in a macro by the contents of a cell which is
outside the table range. (Basically, the user, on a separate sheet picks
from a list box what they want to filter by, and the results go into a linked
cell as usual). At present I am using AutoFilter, but can't seem to put the
cell reference in the Criteria1? Is it possible or am I using incorrect
syntax?

Any help would be great!
 
hi,
how do we know if your are using incorrect syntax unless
you post your code?
 
Assume I record myself applying an autofilter. I get

Selection.AutoFilter Field:=3, Criteria1:="6"

for the criteria argument you could replace the "6" with the range where
the criteria is stored

Criteria1:=Range("M10").Text
 
Thanks for the help Tom - just what I needed!


Tom Ogilvy said:
Assume I record myself applying an autofilter. I get

Selection.AutoFilter Field:=3, Criteria1:="6"

for the criteria argument you could replace the "6" with the range where
the criteria is stored

Criteria1:=Range("M10").Text
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top