ExcelVBAで高速化のための色々ON/OFF

Sub Focus(aSheet As Worksheet, aFlag As Boolean)

    Application.ScreenUpdating = aFlag
    Application.DisplayStatusBar = aFlag
    Application.Calculation = aFlag
    aSheet.EnableCalculation = aFlag
    Application.EnableEvents = aFlag
    aSheet.DisplayPageBreaks = aFlag
    Dim i
    For i = 0 To aSheet.PivotTables.Count - 1
        aSheet.PivotTables(i).ManualUpdate = aFlag
    Next
    Application.PrintCommunication = aFlag

End Sub