The following will reset any auto-filters on all worksheets upon opening the workbook. It won't remove the auto-filters, just reset them.
There are, however, 2 small problems:
1. If I have any worksheet in the workbook (ie data lists) which have no auto-filters, an error is generated:
Runtime error '1004': AutoFilter method of range class failed.
It stops at line
Is there a way to get this macro to not recognise sheets which don't have an auto-filter?
2. It won't work on a password-protected sheet either!
Thanks for looking
Paul S
There are, however, 2 small problems:
1. If I have any worksheet in the workbook (ie data lists) which have no auto-filters, an error is generated:
Runtime error '1004': AutoFilter method of range class failed.
It stops at line
Code:
.AutoFilter Fields:=1
Is there a way to get this macro to not recognise sheets which don't have an auto-filter?
2. It won't work on a password-protected sheet either!
Code:
Public Sub Workbook_Open()
Dim AW As String
AW = ActiveSheet.Name
Application.ScreenUpdating = False
For WSB = 2 To Worksheets.Count
Sheets(WSB).Select
With Selection
.AutoFilter Field:=1
.AutoFilter Field:=2
.AutoFilter Field:=3
.AutoFilter Field:=4
.AutoFilter Field:=5
.AutoFilter Field:=6
.AutoFilter Field:=7
.AutoFilter Field:=8
.AutoFilter Field:=9
.AutoFilter Field:=10
.AutoFilter Field:=11
.AutoFilter Field:=12
End With
Next WSB
Sheets(AW).Select
Application.ScreenUpdating = True
End Sub
Thanks for looking
Paul S