Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pivot Chart printing multiple records

Status
Not open for further replies.
Nov 18, 2002
121
US
I have created a pivotchart. In the field button, you can drop down and select from 430 different patients. When you select the patient, the chart changes to their data. No big deal.

I need to print the charts for each of the 430 different patients from the pivotchart and really do not want to sit here and go click patient, print, click new patient, print.

Is there any solution to this? Thanks!
 


Hi,

1. Create a list of unique patient names. You can use the Advanced Filter, PivotTable or MS Query via Data/Get External Data/Excel Files -- YOUR WORKBOOK...

2.
Code:
for each r in Range(YourUniqueListOfNames)
   PivotTableSheet.PivotTables(1).PageFields(1).CurrentName = r.value
   PivotChartSheet.PrintOut
next
May need some tweeking. Don't know where your PT & PC reside. Assume that you have ONE Page Field.

Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 


In a VBA Module.

alt+F11 toggles between the VB Editor & the active sheet.

In the VB Editor Insert/Module

Paste this code in the code window
Code:
Sub PrintPatients()
    For Each r In Range("Name")
       Sheets("Sheet1").PivotTables(1).PageFields(1).CurrentPage = r.Value
       Sheets("Sheet2").PrintOut
    Next
End Sub
substitute your sheet names.

Run from any sheet...

Tools/Marcro/Macros and select.

Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top