Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Autofilter for multiple sheets

Hi,

I have a macro below to turn the autofilter "on" for multiple selected
sheets but it generated error. Please advise.

Sub auto_filter_all_sheets()
Dim ws As Worksheet
Application.ScreenUpdating = False

sAddress = Selection.Address
For Each ws In ActiveWindow.SelectedSheets
ws.Activate
If sAddress "" Then ws.Range(sAddress).Select
Selection.AutoFilter
Next ws
Application.ScreenUpdating = True
End Sub

TIA.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Autofilter for multiple sheets

Sub auto_filter_all_sheets()
Dim ws As Worksheet
Application.ScreenUpdating = False

if selection.Rows.count < 3 then exit sub
sAddress = Selection.Address
For Each ws In ActiveWindow.SelectedSheets
ws.Range(sAddress).AutoFilter
Next ws
Application.ScreenUpdating = True
End Sub

--
Regards,
Tom Ogilvy

"Agustus" wrote in message
oups.com...
Hi,

I have a macro below to turn the autofilter "on" for multiple selected
sheets but it generated error. Please advise.

Sub auto_filter_all_sheets()
Dim ws As Worksheet
Application.ScreenUpdating = False

sAddress = Selection.Address
For Each ws In ActiveWindow.SelectedSheets
ws.Activate
If sAddress "" Then ws.Range(sAddress).Select
Selection.AutoFilter
Next ws
Application.ScreenUpdating = True
End Sub

TIA.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Autofilter for multiple sheets

Hi Tom,
think Tia needs to return the filter,
assumed the autofilter is already checked up !,
but don't know why she needs to achieve for ?
perhaps :
ws.Range(sAddress).AutoFilter field:="Shomething"
if only turned on or checked up the autofilter, i think no need
do it by automation !?, it wil be more complicating if do it by
automation!
is that r8?

Please reply ..., just guess

Rgds,
halim

Tom Ogilvy menuliskan:
Sub auto_filter_all_sheets()
Dim ws As Worksheet
Application.ScreenUpdating = False

if selection.Rows.count < 3 then exit sub
sAddress = Selection.Address
For Each ws In ActiveWindow.SelectedSheets
ws.Range(sAddress).AutoFilter
Next ws
Application.ScreenUpdating = True
End Sub

--
Regards,
Tom Ogilvy

"Agustus" wrote in message
oups.com...
Hi,

I have a macro below to turn the autofilter "on" for multiple selected
sheets but it generated error. Please advise.

Sub auto_filter_all_sheets()
Dim ws As Worksheet
Application.ScreenUpdating = False

sAddress = Selection.Address
For Each ws In ActiveWindow.SelectedSheets
ws.Activate
If sAddress "" Then ws.Range(sAddress).Select
Selection.AutoFilter
Next ws
Application.ScreenUpdating = True
End Sub

TIA.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Autofilter for multiple sheets

Thank very much, Tom.. It works. The reason is that I have 10+ sheets
and need to turn the filter on for each sheet. With multiple sheets
selected, the menu does not allow autofilter option.

Best regards,
Agustus


wrote:
Hi Tom,
think Tia needs to return the filter,
assumed the autofilter is already checked up !,
but don't know why she needs to achieve for ?
perhaps :
ws.Range(sAddress).AutoFilter field:="Shomething"
if only turned on or checked up the autofilter, i think no need
do it by automation !?, it wil be more complicating if do it by
automation!
is that r8?

Please reply ..., just guess

Rgds,
halim

Tom Ogilvy menuliskan:
Sub auto_filter_all_sheets()
Dim ws As Worksheet
Application.ScreenUpdating = False

if selection.Rows.count < 3 then exit sub
sAddress = Selection.Address
For Each ws In ActiveWindow.SelectedSheets
ws.Range(sAddress).AutoFilter
Next ws
Application.ScreenUpdating = True
End Sub

--
Regards,
Tom Ogilvy

"Agustus" wrote in message
oups.com...
Hi,

I have a macro below to turn the autofilter "on" for multiple selected
sheets but it generated error. Please advise.

Sub auto_filter_all_sheets()
Dim ws As Worksheet
Application.ScreenUpdating = False

sAddress = Selection.Address
For Each ws In ActiveWindow.SelectedSheets
ws.Activate
If sAddress "" Then ws.Range(sAddress).Select
Selection.AutoFilter
Next ws
Application.ScreenUpdating = True
End Sub

TIA.


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
Macro_creating sheets from AutoFilter list Aline Excel Discussion (Misc queries) 1 August 12th 08 02:53 AM
Using Autofilter on Protected sheets Yogin Excel Discussion (Misc queries) 3 August 3rd 08 05:30 PM
AutoFilter on one sheet filters same on other sheets? Conan Kelly Excel Programming 3 March 30th 06 05:32 AM
Autofilter Lists across Multiple Sheets, Maintain Correct Referenc EDSTAFF Excel Worksheet Functions 0 November 14th 05 03:27 PM
Recalculating Excel Sheets with activated autofilter BVA Excel Programming 1 March 5th 04 10:29 AM


All times are GMT +1. The time now is 10:04 PM.

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"