ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Batch Pivot Table update (https://www.excelbanter.com/excel-programming/447260-batch-pivot-table-update.html)

Bobby[_4_]

Batch Pivot Table update
 
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!


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

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