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. |
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. |
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. |
All times are GMT +1. The time now is 12:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com