Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to copy a pivot table and "paste special" formats in excel 07 | Excel Discussion (Misc queries) | |||
Reference an identical cell on a different page using copy/paste? | Excel Worksheet Functions | |||
Printing Table headings at the top of every page | New Users to Excel | |||
Pivot table copy and paste | Excel Worksheet Functions | |||
copy/paste pivot table | Excel Worksheet Functions |