insanity82007
Board Regular
- Joined
- Oct 10, 2007
- Messages
- 130
Hi guys,
How can I change all the fields in the data section of a pivot table from any other function to xlSum?
I've come up with something that I think will work with the correct code, but I can't find the code I need to use ANYWHERE on the net.
How can I change all the fields in the data section of a pivot table from any other function to xlSum?
I've come up with something that I think will work with the correct code, but I can't find the code I need to use ANYWHERE on the net.
Sub CreatePivot()
Dim WSD As Worksheet
Dim PTCache As PivotCache
Dim PT As PivotTable
Dim PF As PivotField
Set WSD = ActiveSheet
a = ActiveCell.PivotField.Name
For Each PT In WSD.PivotTables
For Each PF In PT
With PF
.Function = xlSum
End With
Next PF
Next PT
End Sub