ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   filter (https://www.excelbanter.com/excel-programming/420046-filter.html)

geebee

filter
 
hi,

i have the following:

Sheets("sheet1").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="test"

i would like to know if there is a way i can filter the sheet without
selecting it?

thanks in advance,
geebee


Sheeloo[_3_]

filter
 
You do not need to select the sheet but you do have to pass a range object to
autofilter..

If your headers are in row 1 in sheet 1 then you can use

Sheets("sheet1").Range("A1").autoFilter Field:=2, Criteria1:="test"


"geebee" wrote:

hi,

i have the following:

Sheets("sheet1").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="test"

i would like to know if there is a way i can filter the sheet without
selecting it?

thanks in advance,
geebee



All times are GMT +1. The time now is 01:54 AM.

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