Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dear
Please, I need your help. I'm trying to create a PivotTable based in another PivotTable in the same Workbook. This is the code: Sub Teste() Dim wks As Worksheet Dim wks1 As Worksheet Dim rng As Range Dim rng1 As Range Dim pvt As PivotTable Dim pvt1 As PivotTable Set wks = wksReport Set wks1 = wksData Set rng = wks.Range("C2") Set pvt1 = wks1.PivotTables(1) Set pvt = wks.PivotTableWizard(xlpivotttable, pvt1, rng, "MyDinTable", True, True) ' ... End Sub Running the Sub occurs the error: 1004 - The PivotTable methode has failed! What is the problem? Where can I find a solution? Thanks in advance. Joe |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Joe,
Try using the PivotCache rather than the table. Dim shtOrig As Worksheet Dim pvtOrig As PivotTable Dim shtNew As Worksheet Dim pvtNew As PivotTable Dim pvc As PivotCache Set shtOrig = ThisWorkbook.Worksheets(1) Set shtNew = ThisWorkbook.Worksheets(2) Set pvtOrig = shtOrig.PivotTables(1) Set pvc = pvtOrig.PivotCache Set pvtNew = pvc.CreatePivotTable(shtNew.Range("A1"), "My New Pivot") Sean. -- (please remember to click yes if replies you receive are helpful to you) "Joe" wrote: Hi Dear Please, I need your help. I'm trying to create a PivotTable based in another PivotTable in the same Workbook. This is the code: Sub Teste() Dim wks As Worksheet Dim wks1 As Worksheet Dim rng As Range Dim rng1 As Range Dim pvt As PivotTable Dim pvt1 As PivotTable Set wks = wksReport Set wks1 = wksData Set rng = wks.Range("C2") Set pvt1 = wks1.PivotTables(1) Set pvt = wks.PivotTableWizard(xlpivotttable, pvt1, rng, "MyDinTable", True, True) ' ... End Sub Running the Sub occurs the error: 1004 - The PivotTable methode has failed! What is the problem? Where can I find a solution? Thanks in advance. Joe |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to create pivot table from existing pivot table in excel 2007 | Excel Discussion (Misc queries) | |||
Copying values from pivot table to cells outside pivot table | Excel Discussion (Misc queries) | |||
Filter lines with Pivot table and non pivot table columns | Charts and Charting in Excel | |||
How do I create a pivot table if the pivot table icon or menu ite. | Charts and Charting in Excel | |||
Help required with setting up a pivot table with the source on sheet1 to have the pivot table created on sheet called "report" | Excel Programming |