ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to update datasources of a pivot table ? (https://www.excelbanter.com/excel-programming/387334-how-update-datasources-pivot-table.html)

Olivier B

How to update datasources of a pivot table ?
 
Hi everyone !

My database is changing everyday (adding and removing of lines)
I've got some pivot tables linked with this database in the same workbook.

I want the VBA code to update the datasource range for my pivot table.

I've wrote this code but I can't understand why it is not the main pivot
table that's updating but another one is created bottom side. this last one
has got the updated datasource.

Thanks to help me !!!

'Sheets(tab1).PivotTableWizard SourceType:=xlDatabase,
SourceData:=Sheets("databasis").Range("A17:BJ" &
Sheets("DataBasis").UsedRange.Rows.Count),
TableDestination:=Sheets(tab1).Range("A3")
'Sheets(tab1).PivotTables("Tableau croisé dynamique1").PivotCache.Refresh

--
olivier

Mark J

How to update datasources of a pivot table ?
 
ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh




All times are GMT +1. The time now is 12:05 PM.

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