ateneva
3/26/2018 - 9:06 PM

ForEachPT_ChangeFieldSummaryFunctions.bas

Sub ChangeSummaryFunctions()

Dim Wks As Worksheet
Dim PT As PivotTable
Dim PF As PivotField
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'written by Angelina Teneva, September 2016
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For Each Wks In ActiveWorkbook.Worksheets
    For Each PT In Wks.PivotTables
        For Each PF In PT.DataFields
        
            'comment as needed
            PF.Function = xlSum
            PF.Function = xlCount
            PF.Function = xlCountNums
            PF.Function = xlAverage
            PF.Function = xlProduct
            PF.Function = xlMax
            PF.Function = xlMin
                
        Next PF
    Next PT
        
Next Wks
End Sub