Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 385
Default Printing pivot table along with a copy and paste for each page fie

Well it is pivot tables for me tonight. Hope someone can help. I have:
Printing pivot table code for each page field but when the page field
changes i need to copy and paste (just values)the pivot table to another
worksheet and then print a chart that corresponds to that database. This code
is what i have but it just runs indefinately. Yuck!

Sub PrintPivotPages()
'prints a copy of pivot table for each item in page field
'assumes one page field exists
On Error Resume Next
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Set pt = ActiveSheet.PivotTables.Item(1)
For Each pf In pt.PageFields
For Each pi In pf.PivotItems
pt.PivotFields(pf.Name).CurrentPage = pi.Name
ActiveSheet.PrintOut 'use this for printing
'ActiveSheet.PrintPreview 'use this for testing
With Worksheets("PivotReport")
.Range("PivotTableReport").Copy
End With
With Worksheets("PivotDatabase")
.Range("a1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
End With
Next
Next pf
End Sub
--
Thank you,

Jennifer
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Printing pivot table along with a copy and paste for each page fie

Maybe removing the "on error resume next" line would make any error pop out.

Jennifer wrote:

Well it is pivot tables for me tonight. Hope someone can help. I have:
Printing pivot table code for each page field but when the page field
changes i need to copy and paste (just values)the pivot table to another
worksheet and then print a chart that corresponds to that database. This code
is what i have but it just runs indefinately. Yuck!

Sub PrintPivotPages()
'prints a copy of pivot table for each item in page field
'assumes one page field exists
On Error Resume Next
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Set pt = ActiveSheet.PivotTables.Item(1)
For Each pf In pt.PageFields
For Each pi In pf.PivotItems
pt.PivotFields(pf.Name).CurrentPage = pi.Name
ActiveSheet.PrintOut 'use this for printing
'ActiveSheet.PrintPreview 'use this for testing
With Worksheets("PivotReport")
.Range("PivotTableReport").Copy
End With
With Worksheets("PivotDatabase")
.Range("a1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
End With
Next
Next pf
End Sub
--
Thank you,

Jennifer


--

Dave Peterson
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 copy a pivot table and "paste special" formats in excel 07 kswan Excel Discussion (Misc queries) 1 October 16th 07 01:27 PM
Reference an identical cell on a different page using copy/paste? Radar Excel Worksheet Functions 4 August 29th 05 05:21 PM
Printing Table headings at the top of every page jayceejay New Users to Excel 1 July 13th 05 08:04 PM
Pivot table copy and paste yllee70 Excel Worksheet Functions 0 February 23rd 05 07:39 AM
copy/paste pivot table Todd L. Excel Worksheet Functions 0 December 30th 04 04:11 PM


All times are GMT +1. The time now is 04:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"