Re: pivot table chart/graphing

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Debra Dalgleish (dsd_at_contexturesXSPAM.com)
Date: 10/13/04


Date: Wed, 13 Oct 2004 13:14:32 -0400

The code assumes that your pivot table on a work*** named Pivot and
the pivot chart is on a chart *** named Chart1.

marina madeleine wrote:
> Debra,
>
> A while back I had inquired about how to do a "show pages" for the excel
> pivot charting function, and you had suggested the following code to do
> this (attached below). I tried out the code, but somehow keep coming up
> with the following error:
>
> run-time error 9
> subscript out of range
>
> It seems to crop up at this line:
> Set pt = Worksheets("Pivot").PivotTables(1)
>
> Do you know why this is coming up and how to fix it? Does it matter
> where in the work*** the macro is run from?
>
> Thanks.
>
> Marina
>
> Sub PrintPivotChart()
> 'prints a chart for each item in the page field
> Dim pt As PivotTable
> Dim pf As PivotField
> Dim pi As PivotItem
>
> Set pt = Worksheets("Pivot").PivotTables(1)
> For Each pf In pt.PageFields
> For Each pi In pf.PivotItems
> pt.PivotFields(pf.Name).CurrentPage = pi.Name
> ' ActiveWorkbook.Charts("Chart1").PrintOut
> ActiveWorkbook.Charts("Chart1").PrintPreview
> Next
> Next pf
> End Sub
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

-- 
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

Quantcast