ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filter in macro (https://www.excelbanter.com/excel-programming/323828-filter-macro.html)

pom

Filter in macro
 
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!

No Name

Filter in macro
 
hi,
how do we know if your are using incorrect syntax unless
you post your code?

-----Original Message-----
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!
.


pom

Filter in macro
 
you could just possibly tell me the correct syntax!


" wrote:

hi,
how do we know if your are using incorrect syntax unless
you post your code?

-----Original Message-----
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!
.



Tom Ogilvy

Filter in macro
 
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


--
Regards,
Tom Ogilvy


"POM" wrote in message
...
you could just possibly tell me the correct syntax!


" wrote:

hi,
how do we know if your are using incorrect syntax unless
you post your code?

-----Original Message-----
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!
.





pom

Filter in macro
 
Thanks for the help Tom - just what I needed!


"Tom Ogilvy" wrote:

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


--
Regards,
Tom Ogilvy


"POM" wrote in message
...
you could just possibly tell me the correct syntax!


" wrote:

hi,
how do we know if your are using incorrect syntax unless
you post your code?

-----Original Message-----
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!
.







All times are GMT +1. The time now is 10:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com