I wrote a macro that I attached to a button to reapply the filters on all my sheets and it says it works, but it doesn't actually do anything. What is wrong with it? Is there another way? Or even make it work for one sheet?
Sub UniversalFilterRefresh()
Dim ws As Worksheet
Dim count As Integer
count = 0
' 1. Optimization
Application.ScreenUpdating = False
On Error Resume Next ' Robust error handling for cloud environments
' 2. Loop through every single worksheet in the file
For Each ws In ThisWorkbook.Worksheets
' Check if the sheet has an AutoFilter turned on
If ws.AutoFilterMode Then
' Re-apply the filter criteria
ws.AutoFilter.ApplyFilter
count = count + 1
End If
Next ws
' 3. Restore settings
Application.ScreenUpdating = True
On Error GoTo 0
' 4. Final report
MsgBox "Process complete. Refreshed filters on " & count & " sheets.", vbInformation
End Sub