View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
HKS HKS is offline
external usenet poster
 
Posts: 10
Default VBA code to refresh Child Pivot Table

In one workbook, I have three parent pivot tables and ten child pivot tables.
I want a macro to refresh these child tables from different parent tables. I
wrote a macro and it always has the runtime error in the following code
(second row of the code). Any advise/idea?

Dim vWSMain as Parent PivotTable worksheet
Dim vWSChild as Child PivotTable worksheet
Dim vTableChild as Child PivotTable
Dim vTableParent1 as Parent PivotTable #1

Set vTableChild = ActiveCell.PivotTable
Worksheets(vWSMain).PivotTableWizard SourceType:=xlPivotTable, _
SourceData:=vTableParent1
Worksheets(vWSChild).PivotTables(vTableChild).Pivo tCache.BackgroundQuery =
True

Thanks