PC Review


Reply
Thread Tools Rate Thread

Creating pivot table to Existing worksheet

 
 
Malvaro
Guest
Posts: n/a
 
      27th Aug 2008

Here's all the relevant information:

a) I was able to successfully create a pivot table, in a newly created
tab named "Sheet2". This pivot table is contained in A:E, was copied
and the duplicate of that pivot table pasted into I:M.

b) Next I attempted to generate a new pivot table, using a new data
range, to the "Existing worksheet" at P:V. When running the VBC code
for the new pivot table I get the error "Run Time 1004: Unable to get
the Pivot Table Property of the Worksheet class"

The broken VBA code is below:
>
> Sheets("Raw Data").Select
> ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
> "'Raw Data'!R2C1:R" & RowCount & "C54").CreatePivotTable
> TableDestination:= _
> "'[MBR Prep Work 1.1.xls]Sheet2'!R1C16", TableName:="PivotTable3", _
> DefaultVersion:=xlPivotTableVersion10
> ActiveSheet.PivotTables("PivotTable3").AddFields RowFields:=Array( _
> "Column1", "Column2", "Column3", "Column4", "Column5"), ColumnFields:=
> _
> "Month"
> ActiveSheet.PivotTables("PivotTable3").PivotFields("Case
> No").Orientation = _
> xlDataField
>


Also, as a kinda-related question: Using VBA, can one create a new
pivot table using the data range of the previous / original pivot
table. The manual option that says something about "saving memory and
making workbook the smaller"? If so, can you point me in the direction
of an example somewhere?

Any help would be greatly appreciated!!!




--
Malvaro
 
Reply With Quote
 
 
 
 
Malvaro
Guest
Posts: n/a
 
      29th Aug 2008

I wonder if the target worksheet must be actually named, vs the default
Sheet1, Sheet2, Sheet3, etc etc

> ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
> "'Raw Data'!R2C1:R" & RowCount & "C54").CreatePivotTable
> TableDestination:= _
> [MBR Prep Work 1.1.xls]*_Sheet2_*'!R1C16


Would that actually make a difference?




--
Malvaro
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating worksheet reports from a pivot table Donna Microsoft Excel Worksheet Functions 1 17th Aug 2009 01:55 AM
Re: adding a pivot table to an existing worksheet- HELP!! Debra Dalgleish Microsoft Excel Misc 0 21st Dec 2006 12:11 AM
how to create pivot table from existing pivot table in excel 2007 =?Utf-8?B?VWRheXJhaiBEaHVsZWthcg==?= Microsoft Excel Misc 1 15th Dec 2006 04:23 AM
Creating a Pivot Table with data in more than one worksheet =?Utf-8?B?UmVoYW4=?= Microsoft Excel Worksheet Functions 1 6th Dec 2005 12:04 PM
Pivot Table Creating New Columns that Subtract Two Existing Columns den4673 Microsoft Excel Misc 3 17th Dec 2004 01:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:25 AM.