Batch Pivot Table update

B

Bobby

Could someone tell me why if I do a Pivot "Source Change All" with VBA the code does update only 1 source instead of the 2 on 1 specific sheet?

Tab Sidel NAN0 100 Pivot Table dynamique2 C:\Name_fruits\Name\[Name rapports de fruits 2012-2013 .xls]Sidel_Nano'!C1:C20

This is the unchanged source(look at the year):
Tab Sidel NAN0 100 Pivot Table dynamique35 C:\Name_fruits\Name\[Name rapports de fruits 2011-2012 .xls]Sidel_Nano'!C1:C20

This is part of the code:
For Each ws In wb.Worksheets
For Each pt In ws.PivotTables
tmp = pt.SourceData
strSD = Replace(tmp, "2011-2012", "2012-2013")
pt.ChangePivotCache _
wb.PivotCaches.Create(SourceType:=xlDatabase, _
SourceData:=strSD)
Next pt
Next ws

Thank's ahead!
 

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