Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

code for auto filters

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gordon - 20 Jan 2006 10:19 GMT
Hi...

I'm stuck. I'm after some code that will allow a macro button to do the
following...

1. reset all auto filters to standing position (all unfiltered)
2. then filter range a1:a100 for top 10 values without a dialog box popping
up.

It all needs to be easy and intuitive, push of a button feel without the
user thinking about anything.

Thanks...you're my only hope!

Gordon.
Roger Govier - 20 Jan 2006 10:43 GMT
Hi Gordon

Try
Sub Setfilter()

   Selection.AutoFilter
   Selection.AutoFilter Field:=1, Criteria1:="10",
Operator:=xlTop10Items

End Sub

Signature

Regards

Roger Govier

> Hi...
>
[quoted text clipped - 14 lines]
>
> Gordon.
paul.robinson@it-tallaght.ie - 20 Jan 2006 11:29 GMT
Hi

sub FilterIt()
'Remove any filter present on the Range
   With ActiveSheet
       On Error Resume Next    'required if Advanced filter was used
           .ShowAllData
       On Error GoTo 0
       .AutoFilterMode = False   'Removes drop down arrows
       'do the filter
       .Range("A1:A100).AutoFilter Field:=1,
Criteria1:=Criteria1:="10",

 Operator:=xlTop10Items
   End with
End Sub

regards
Paul
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.