<font face=Courier New><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> formatAllPivotTableDataArea()<br><SPAN style="color:#00007F">Dim</SPAN> ws <SPAN style="color:#00007F">As</SPAN> Worksheet<br><SPAN style="color:#00007F">Dim</SPAN> pvtTable <SPAN style="color:#00007F">As</SPAN> PivotTable<br><SPAN style="color:#00007F">Dim</SPAN> pvtField <SPAN style="color:#00007F">As</SPAN> PivotField<br><br><SPAN style="color:#007F00">'don't allow screen updating because it takes time</SPAN><br>Application.ScreenUpdating = <SPAN style="color:#00007F">False</SPAN><br><SPAN style="color:#007F00">'loop through each worksheet</SPAN><br><SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> ws <SPAN style="color:#00007F">In</SPAN> ThisWorkbook.Worksheets<br>MsgBox ws.Name<br><SPAN style="color:#007F00">'loop through each pivot table in the current worksheet</SPAN><br><SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> pvtTable <SPAN style="color:#00007F">In</SPAN> ws.PivotTables<br><br><SPAN style="color:#007F00">'This command changes the formatting of the data values area from "Count of" to "Sum of"</SPAN><br><SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> pvtField <SPAN style="color:#00007F">In</SPAN> pvtTable.DataFields<br><br><SPAN style="color:#007F00">'MsgBox pf</SPAN><br>pvtField.Function = xlSum<br>pvtField.NumberFormat = "£#,##0.00_);[Red](£#,##0.00)"<br><SPAN style="color:#00007F">Next</SPAN> pvtField<br><SPAN style="color:#007F00">'refresh the pivot table</SPAN><br>pvtTable.PivotCache.Refresh<br><br><SPAN style="color:#00007F">Next</SPAN> pvtTable<br><SPAN style="color:#007F00">'tell the user you are done with the refresh for each pivot table in current worksheet</SPAN><br>MsgBox "The worksheet " & ws.Name & " and the pivot table are refreshed."<br><br><SPAN style="color:#00007F">Next</SPAN> ws<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>