#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Pivot Table

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Pivot Table

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
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
how to create pivot table from existing pivot table in excel 2007 Udayraj Dhulekar Excel Discussion (Misc queries) 2 July 8th 13 08:22 PM
Copying values from pivot table to cells outside pivot table richzip Excel Discussion (Misc queries) 4 January 16th 08 11:03 PM
Filter lines with Pivot table and non pivot table columns Grover Charts and Charting in Excel 4 September 28th 07 03:16 AM
How do I create a pivot table if the pivot table icon or menu ite. Lynn@WS Charts and Charting in Excel 1 December 16th 04 02:36 AM
Help required with setting up a pivot table with the source on sheet1 to have the pivot table created on sheet called "report" Diana[_5_] Excel Programming 0 August 21st 03 10:19 PM


All times are GMT +1. The time now is 08:46 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"