VBA Excel Code
Posted on 2011-02-23
We have many speadsheets within our workplace that alot of people have access to.
These spreadsheets have many sheets (tabs) which all have auto filters set.
The problems we have are people are leaving the auto filters on and then when somebody else goes in the spreadsheet they are reporting wrong information because they havent relaised the filter is still on.
I have in place a macro that removes all filters upon opening the spreadsheet put this currently only works on the first (active) sheet.
The code i have at the moment is below:
'put the autofilter back on if it has been removed.
If ActiveSheet.AutoFilterMode = False Then Rows(1).AutoFilter
'error handle the showalldata part
On Error Resume Next
For Each ws In ActiveWorkbook.ShowAllData
On Error GoTo 0
Is there something i can change for it to apply to all sheets.