Dear Sir
I have the following macro to add filters on all worksheets based on Variatus suggestion in May 28 , 2018. It works perfecly as I wanted before.
Refer to the link
https://www.teachexcel.com/talk/2740/add-filters-on-all-worksheets#topic_answer_section_anchor
I want to have the modified macros that look at several sheets at once, and run the code on the Activate event just for the sheet i am really looking at.
Best regards
Arsil Hadjar
Sub AddFilter_on_allWorksheet()
Dim Sh As Worksheet
Dim Rng As Range
Application.ScreenUpdating = False ' stop screen flicker
For Each Sh In Worksheets
With Sh
If .AutoFilterMode Then .AutoFilterMode = False
Set Rng = Range(.Cells(3, 1), .Cells(3, .UsedRange.Columns.Count))
Rng.AutoFilter
.Activate
.Range("J4").Select
End With
With ActiveWindow
If .FreezePanes Then .FreezePanes = False
.FreezePanes = True
End With
Next Sh
Application.ScreenUpdating = True
End Sub