Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default code for auto filters

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,886
Default code for auto filters

Hi Gordon

Try
Sub Setfilter()

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

End Sub

--
Regards

Roger Govier


"Gordon" wrote in message
...
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default code for auto filters

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I use "OR" in two auto-filters/custom filters? Roady Excel Discussion (Misc queries) 1 May 24th 10 06:11 PM
Auto Filters se7098 Excel Worksheet Functions 2 October 13th 08 11:24 PM
How can I auto-refresh auto-filters when data changes? Mike@MPWco Excel Worksheet Functions 0 July 4th 06 12:50 PM
auto filters chanceygardener Excel Discussion (Misc queries) 5 April 27th 06 05:32 PM
Unprotect Auto Filters Gordon[_2_] Excel Programming 1 October 28th 05 02:52 PM


All times are GMT +1. The time now is 08:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"