How to update datasources of a pivot table ?

G

Guest

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
 

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