FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,366
- Office Version
- 365
- 2016
- Platform
- Windows
In lieu of placing the array of sheets within the two procedures below, how can I use a third procedure to establish the array of sheets and then pass that argument?
Code:
Sub ApplyAutofilter()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4"))
ws.Range("A1").AutoFilter 1, Sheet5.Range("K4")
Next
End Sub
Code:
Sub TurnOffAutoFilter()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4"))
ws.AutoFilterMode = False
Next
End Sub