ExcelBanter

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

Rhoswen

Filter by macro
 
Is it possible to write a macro that will do an AutoFilter? I need a macro
that will autofilter the same column for the same criteria every time.

Anybody?

Mike H

Filter by macro
 
Hi,

The simplest way and because of the lack of detail in the question would be
for you to record a macro of yourself doing it or you may be able to build on
this

Range("A1").AutoFilter Field:=1, Criteria1:="JohnDoe"

Mike

"Rhoswen" wrote:

Is it possible to write a macro that will do an AutoFilter? I need a macro
that will autofilter the same column for the same criteria every time.

Anybody?


Rick Rothstein

Filter by macro
 
Yes, use the AutoFilter method of the Range object. If you had told us more,
we could have actually constructed the statement for you. Since you didn't,
you will have to look the AutoFilter method up in the help files.

--
Rick (MVP - Excel)


"Rhoswen" wrote in message
...
Is it possible to write a macro that will do an AutoFilter? I need a macro
that will autofilter the same column for the same criteria every time.

Anybody?



Rhoswen

Filter by macro
 
Mike,

Not really much more detail to offer. It's as simple as it seems. You're
code is exactly what I needed to build on. Thanks!

"Mike H" wrote:

Hi,

The simplest way and because of the lack of detail in the question would be
for you to record a macro of yourself doing it or you may be able to build on
this

Range("A1").AutoFilter Field:=1, Criteria1:="JohnDoe"

Mike

"Rhoswen" wrote:

Is it possible to write a macro that will do an AutoFilter? I need a macro
that will autofilter the same column for the same criteria every time.

Anybody?



All times are GMT +1. The time now is 09:39 AM.

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