randombubble3
New Member
- Joined
- Mar 15, 2021
- Messages
- 1
- Office Version
- 2019
- Platform
- Windows
I changed the code using the answer I saw here that helped generate the 2 out of 3 of my pivot tables, but the last one isn't generating. Any tips on how to get the last pivot table to work? Every time I try to run the code, it says I need to debug it.
First 2 codes that worked are below, and the bottom 2 are the code variations for that pivot table that did not work. (View as separate and not connected together)
First 2 codes that worked are below, and the bottom 2 are the code variations for that pivot table that did not work. (View as separate and not connected together)
VBA Code:
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Sheet1!R1C1:R234C33", Version:=6).CreatePivotTable TableDestination:=Worksheets("3. Summary").Range("A1"), TableName:="PivotTable6", DefaultVersion:=6
ActiveWorkbook.Worksheets("3. Summary").PivotTables("PivotTable6"). _
PivotCache.CreatePivotTable TableDestination:=Worksheets("4. Summary1").Range("A1"), TableName:="PivotTable7", DefaultVersion _
:=6
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Sheet1!R1C1:R234C33", Version:=6).CreatePivotTable TableDestination:=Worksheets("5. Summary2").Range("A1"), TableName:="PivotTable8", DefaultVersion:=6
ActiveWorkbook.Worksheets("3. Summary").PivotTables("PivotTable6"). _
PivotCache.CreatePivotTable TableDestination:=Worksheets("5. Summary2").Range("A1"), TableName:="PivotTable8", DefaultVersion _
:=6