Hello. Excel 2003.
When coding to refresh a pivot table it forgets the source data - it collapses to a single row.
It also forgets the groupings I set up.
Is it possible to get around these problems? What is the instruction to redefine a PivotCaches' SourceData?
Thanks, Andy.
Program Pivot Table
-
- SilverLounger
- Posts: 2403
- Joined: 05 Feb 2010, 22:21
- Location: London ENGLAND
Program Pivot Table
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Program Pivot Table
Code like
ActiveSheet.PivotTables(1).PivotCache.Refresh
shouldn't "forget" the source data. What code are you using?
ActiveSheet.PivotTables(1).PivotCache.Refresh
shouldn't "forget" the source data. What code are you using?
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 2403
- Joined: 05 Feb 2010, 22:21
- Location: London ENGLAND
Re: Program Pivot Table
Hi. It's not me, and they haven't got the source code with them unfortunately.
Thanks, Andy.
Thanks, Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Program Pivot Table
If you want to change the source data of a pivot table, you can do it like this:
ActiveSheet.PivotTables(1).SourceData = Worksheets("Sheet1").Range("A1").CurrentRegion.Address(External:=True)
ActiveSheet.PivotTables(1).SourceData = Worksheets("Sheet1").Range("A1").CurrentRegion.Address(External:=True)
Best wishes,
Hans
Hans