Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoFilter Field on a none selectet sheet? 1

Status
Not open for further replies.

ChristianDK

Programmer
May 31, 2007
18
DK
Hello

Can anyone help me out on this topic:

I got a large Excel workbook and need to run it on some slow computers.

Sheets("sheet1").Select
Selection.AutoFilter Field:=1, Criteria1:="="

But I like to be able to use autofilter without selecting the sheet. Something like:

Sheets("sheet1").Selection.AutoFilter Field:=1, Criteria1:="="

Anyone know if this can be done and how?:)

 



Hi,

IMHO, Selection should be used almost NEVER in code, because you never know where either your fingers or someone elses fingers have been....
Code:
Sheets("sheet1").Range{"A1"}.AutoFilter _
    Field:=1, _
    Criteria1:="="
where A1 is in the filter.

Skip,

[glasses] [red][/red]
[tongue]
 
Thanks Skip

You are the man!

some small info, dont use {} but () insted :)
 




Thanks. It was a moment of indecision between...
Code:
Sheets("sheet1").[A1]
and
Sheets("sheet1").Range("A1")
that came out incorrect. [blush]

Skip,

[glasses] [red][/red]
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top