SRMPURCHASE
Board Regular
- Joined
- Dec 23, 2014
- Messages
- 212
- Office Version
- 2016
- Platform
- Windows
I use this macro to change all data fields to summarize value fields by: "Sum", how would I modify it to change all data fields to "Currency" Number format?
Sub SumAllValueFields()
Dim pt As PivotTable
Dim pf As PivotField
Dim WS As Worksheet
Set WS = ActiveSheet
Set pt = WS.PivotTables(1)
Application.ScreenUpdating = False
pt.ManualUpdate = True
For Each pf In pt.DataFields
pf.Function = xlSum
Next pf
pt.ManualUpdate = False
Application.ScreenUpdating = True
Set pf = Nothing
Set pt = Nothing
Set WS = Nothing
End Sub
Sub SumAllValueFields()
Dim pt As PivotTable
Dim pf As PivotField
Dim WS As Worksheet
Set WS = ActiveSheet
Set pt = WS.PivotTables(1)
Application.ScreenUpdating = False
pt.ManualUpdate = True
For Each pf In pt.DataFields
pf.Function = xlSum
Next pf
pt.ManualUpdate = False
Application.ScreenUpdating = True
Set pf = Nothing
Set pt = Nothing
Set WS = Nothing
End Sub