Macro Question. Is refresh needed?

D

douglascfast

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top