Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
HKS HKS is offline
external usenet poster
 
Posts: 10
Default Macro 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.
However I always have debug error in the following code. What did I do wrong
here?

Set vTableChild = ActiveCell.PivotTable
Worksheets(vWSMain).PivotTableWizard SourceType:=xlPivotTable,
SourceData:=vTableParent1

Worksheets(vWSChild).PivotTables(vTableChild).Pivo tCache.BackgroundQuery =
True

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Macro to Refresh child pivot table

Now I am pretty rough at this, but the pivot tables are a function of the
worksheet. They can also be named (like a range).
For Each WS In Worksheets
For Each PT In WS.PivotTables
PT.PivotCache.Refresh
Next PT
Next WS

try renaming the Parent pivot tables and then pointing the children to those
sources.
"HKS" wrote:

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.
However I always have debug error in the following code. What did I do wrong
here?

Set vTableChild = ActiveCell.PivotTable
Worksheets(vWSMain).PivotTableWizard SourceType:=xlPivotTable,
SourceData:=vTableParent1

Worksheets(vWSChild).PivotTables(vTableChild).Pivo tCache.BackgroundQuery =
True

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
HKS HKS is offline
external usenet poster
 
Posts: 10
Default Macro to Refresh child pivot table

Thanks for reply.
I tried your code before, but nothing seem updated.
Could you please update the below sample code about what you said pointing
the child PT to the parent PT?

Worksheets(ParentWorkSheet).Activate
vParentPTname = ActiveSheet.PivotTables(1).Name

For Each WS In Child Worksheets
For Each PT In WS.PivotTables
PT.PivotCache.Refresh
Next PT
Next WS

Thanks!
HKS

"Candyman" wrote:

Now I am pretty rough at this, but the pivot tables are a function of the
worksheet. They can also be named (like a range).
For Each WS In Worksheets
For Each PT In WS.PivotTables
PT.PivotCache.Refresh
Next PT
Next WS

try renaming the Parent pivot tables and then pointing the children to those
sources.
"HKS" wrote:

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.
However I always have debug error in the following code. What did I do wrong
here?

Set vTableChild = ActiveCell.PivotTable
Worksheets(vWSMain).PivotTableWizard SourceType:=xlPivotTable,
SourceData:=vTableParent1

Worksheets(vWSChild).PivotTables(vTableChild).Pivo tCache.BackgroundQuery =
True

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Macro to Refresh child pivot table

well I said i was rough. You may have to reserch Pivots more and how to set
properties. Sorry
Dim vParentPT1 as pivottable
Dim PT2 as pivottable

Worksheets(ParentWorkSheet).Activate
vParentPT1 = ActiveSheet.PivotTables(1)
vParentPT2 = worksheets(2).PivotTables(1)

vParentPTname = vParentPT1.Name
vParentPTname2 = vParentPT2.Name


For Each WS In Child Worksheets
For Each PT In WS.PivotTables
set the property
PT.PivotCache.Refresh
Next PT
Next WS

Sorry this is lame, but I'd hoped to encourage you in some direction.
Maybe someone else out there has more.


"HKS" wrote:

Thanks for reply.
I tried your code before, but nothing seem updated.
Could you please update the below sample code about what you said pointing
the child PT to the parent PT?

Worksheets(ParentWorkSheet).Activate
vParentPTname = ActiveSheet.PivotTables(1).Name

For Each WS In Child Worksheets
For Each PT In WS.PivotTables
PT.PivotCache.Refresh
Next PT
Next WS

Thanks!
HKS

"Candyman" wrote:

Now I am pretty rough at this, but the pivot tables are a function of the
worksheet. They can also be named (like a range).
For Each WS In Worksheets
For Each PT In WS.PivotTables
PT.PivotCache.Refresh
Next PT
Next WS

try renaming the Parent pivot tables and then pointing the children to those
sources.
"HKS" wrote:

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.
However I always have debug error in the following code. What did I do wrong
here?

Set vTableChild = ActiveCell.PivotTable
Worksheets(vWSMain).PivotTableWizard SourceType:=xlPivotTable,
SourceData:=vTableParent1

Worksheets(vWSChild).PivotTables(vTableChild).Pivo tCache.BackgroundQuery =
True

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
HKS HKS is offline
external usenet poster
 
Posts: 10
Default Macro to Refresh child pivot table

Thanks Candyman! Next time you shd be rougher, I didn't have any black-eye
yet. I'm still hoping to receive more tips about the pointing the child PT to
the parent PT, I didn't have any luck researching the code yet.

"Candyman" wrote:

well I said i was rough. You may have to reserch Pivots more and how to set
properties. Sorry
Dim vParentPT1 as pivottable
Dim PT2 as pivottable

Worksheets(ParentWorkSheet).Activate
vParentPT1 = ActiveSheet.PivotTables(1)
vParentPT2 = worksheets(2).PivotTables(1)

vParentPTname = vParentPT1.Name
vParentPTname2 = vParentPT2.Name


For Each WS In Child Worksheets
For Each PT In WS.PivotTables
set the property
PT.PivotCache.Refresh
Next PT
Next WS

Sorry this is lame, but I'd hoped to encourage you in some direction.
Maybe someone else out there has more.


"HKS" wrote:

Thanks for reply.
I tried your code before, but nothing seem updated.
Could you please update the below sample code about what you said pointing
the child PT to the parent PT?

Worksheets(ParentWorkSheet).Activate
vParentPTname = ActiveSheet.PivotTables(1).Name

For Each WS In Child Worksheets
For Each PT In WS.PivotTables
PT.PivotCache.Refresh
Next PT
Next WS

Thanks!
HKS

"Candyman" wrote:

Now I am pretty rough at this, but the pivot tables are a function of the
worksheet. They can also be named (like a range).
For Each WS In Worksheets
For Each PT In WS.PivotTables
PT.PivotCache.Refresh
Next PT
Next WS

try renaming the Parent pivot tables and then pointing the children to those
sources.
"HKS" wrote:

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.
However I always have debug error in the following code. What did I do wrong
here?

Set vTableChild = ActiveCell.PivotTable
Worksheets(vWSMain).PivotTableWizard SourceType:=xlPivotTable,
SourceData:=vTableParent1

Worksheets(vWSChild).PivotTables(vTableChild).Pivo tCache.BackgroundQuery =
True

Thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Table - Parent to Child Data Brennan Excel Discussion (Misc queries) 1 September 24th 08 05:23 AM
VBA code to refresh Child Pivot Table HKS Excel Discussion (Misc queries) 0 May 7th 08 07:49 PM
Run macro on refresh data (pivot table) J.W. Aldridge Excel Programming 0 December 28th 06 03:49 PM
pivot table refresh macro kraway Excel Discussion (Misc queries) 2 November 14th 06 02:38 PM
Timing of automatic query refresh and macro pivot table refresh dutty Excel Programming 2 December 1st 04 07:19 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"