Hi. With the code below, I'm able to update only Pivot table 3 on the active sheet with a values field. Is there a way to do this for multiple tables on multiple sheets?
Code
Sub AddValuesField()
Dim pvt As PivotTable
Dim pf As String
Dim pf_Name As String
pf = "Period Net Posting"
pf_Name = "Sum of Period Net Posting"
Set pvt = ActiveSheet.PivotTables("PivotTable3")
pvt.AddDataField pvt.PivotFields("Period Net Posting"), "Sum of Period Net Posting", xlSum
End Sub
Display More