ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro Question. Is refresh needed? (https://www.excelbanter.com/excel-programming/399847-macro-question-refresh-needed.html)

[email protected]

Macro Question. Is refresh needed?
 
Hello All,

Hope someone can answer this for me.

In the code below I was told to refresh the pivot table, yet the code
runs and the un-needed items disapear even with out the refresh.

Can someone tell me why the refresh statement is needed?


Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Dim SFld As String
SFld = "Uplift month"

For Each pt In ActiveSheet.PivotTables
Set pf = pt.PivotFields(SFld)
For Each pi In pf.PivotItems
pi.Caption = pi.SourceName
Next pi

pt.RefreshTable
Next pt

End Sub

Thanks everyone

Doug



All times are GMT +1. The time now is 09:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com