View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] douglascfast@hotmail.com is offline
external usenet poster
 
Posts: 19
Default 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