Excel VBA Video Training/ EXCEL DASHBOARD REPORTS

FREE Excel STUFF
PRODUCTS
Development
Contact
Excel Online

Printing PivotTables & PivotCharts

 

 Print Each Page Field (Report Filter) Of Pivot Tables & Pivot Charts

See Also: PivotTables | Refresh Pivot Table via Excel Macros || Hide/Show Pivot Table Field Items || Excel Subtotals || Making the SUBTOTAL Function Dynamic || Bold Excel Subtotals Automatically || Sum Every Nth Cell || Count of Each Item in a List || Grouping Pivot Tables Problems
Sub PrintAllPivotPageFields()

Dim pt As PivotTable, pi As PivotItem, pf As PivotField

Dim lLoop As Long

 

''Wrtten by www.ozgrid.com

''Prints out each PivotTable PageField

 

Set pt = Sheet1.PivotTables(1) 'Change to suit

''http://www.ozgrid.com/VBA/excel-vba-sheet-names.htm

Set pf = pt.PageFields(1) 'Change to suit

 

    For Each pi In pf.PivotItems

        pi.Value = pi.Value

            If lLoop = 0 Then

                With Sheet1.PageSetup

                    .CenterFooter = pi.Value

                    .LeftHeader = pt.Name

                    .LeftFooter = Now

                    .PrintArea = pt.TableRange2.Address

                End With

            End If

        Sheet1.PrintOut

        lLoop =lLoop +1

    Next pii

End Sub
Sub PrintAllPivotChartPageFields()

Dim pt As PivotTable, pi As PivotItem, pf As PivotField

Dim lLoop As Long

 

''Wrtten by www.ozgrid.com

''Prints out each PivotChart PageField

 

Set pt = Sheet1.PivotTables(1) 'Change to suit

''http://www.ozgrid.com/VBA/excel-vba-sheet-names.htm

Set pf = pt.PageFields(1) 'Change to suit

 

    For Each pi In pf.PivotItems

        pi.Value = pi.Value

            If lLoop = 0 Then

                With Chart4.PageSetup ''CodeName of PivotChart Chart Sheet

                    ''http://www.ozgrid.com/VBA/excel-vba-sheet-names.htm

                    .CenterFooter = pi.Value

                    .LeftHeader = pt.Name

                    .LeftFooter = Now

                End With

            End If

        Chart4.PrintOut

        lLoop = lLoop + 1

    Next pi

End Sub

Special! Free Choice of Complete Excel Training Course OR Excel Add-ins Collection on all purchases totaling over $70.00. ALL purchases totaling over $150.00 gets you BOTH! Purchases MUST be made via this site. Send payment proof to [email protected] 31 days after purchase date.

NOTE: None of the Microsoft Excel videos are from ozgrid. More Excel Video Tutorials

Microsoft�, Microsoft Excel� and Google� are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft or Google.

�2001-2008 ozgrid. All right reserved