LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Playing back a Pivot Table macros

I’m using Excel 2010 and I have some VBA code that does the following things.
• Makes a copy of sheet 1 and calls it MySheet.
• Inserts a column and does several calculations in MySheet.
• Attempts to perform a pivot table from the data in MySheet and place this Pivot table on a new and separate sheet.
It is this last step with which I am having trouble. I recorded the Pivot table macro manually but upon playback it always breaks on the second line below. It is the line that begins with the words ActiveWorkbook.PivotCaches. Can someone tell me what I’m doing wrong? Thank you.

Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDa tabase, SourceData:= _
"MySheet!R1C1:R35C4", Version:=xlPivotTableVersion14).CreatePivotTable _
TableDestination:="Sheet27!R3C1", TableName:="PivotTable2", DefaultVersion _
:=xlPivotTableVersion14
Sheets("Sheet27").Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("PivotTable2").PivotFields ("CC_DD")
.Orientation = xlRowField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable2").AddDataFiel d ActiveSheet.PivotTables( _
"PivotTable2").PivotFields("Hours"), "Sum of Hours", xlSum
Sheets("Sheet25").Select
Sheets("Sheet25").Move After:=Sheets(3)
Sheets("Sheet25").Select
Sheets("Sheet25").Name = "Pivot Table"

 
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
Excel Pivot table - getting back to the skeleton template georgec7 Excel Discussion (Misc queries) 3 April 7th 10 12:43 AM
Convert Pivot table back to Data Table Samaa Excel Discussion (Misc queries) 2 March 21st 07 10:02 AM
convert Pivot table back to Data table Samaa Excel Discussion (Misc queries) 2 March 21st 07 09:22 AM
Transforming pivot table back to the source table Frile Excel Worksheet Functions 0 February 14th 06 08:54 AM
Macros for playing sounds NAWBUS Excel Discussion (Misc queries) 3 December 15th 04 12:30 PM


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