PC Review


Reply
Thread Tools Rate Thread

Creating Multiple Charts from Same Pivot Table using macro

 
 
=?Utf-8?B?S2VuWQ==?=
Guest
Posts: n/a
 
      19th Apr 2007
Hi
I have been writing a macro to process/reformat multiple data streams into a
single table for analysis. Analysis is driven by pivot table and associated
pivot chart. What I would like to do is to generate several chart views in
sequence, grabbing a copy or picture of each chart to form a standard report.

Problem - Excel does not allow copy/pastespecial/picture type actions on a
PivotChart.

Possible solutions with issues
1 It does not seem efficient to create the pivot table, pivot chart and
then delete the associated pivot table (as I understand 'Help' to be telling
me I should) just to get the picture.
2 Creating multiple instances of the pivot table with different field
selections and a pivot chart associated with instance does not seem to
efficient either.

Can anyone suggest a better way?

Thanks
--
KenY
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      19th Apr 2007
Hi,

You can copy the pivot chart as a picture in VBA. Here's an example:

Sub test()
'copy Chart1 as picture
Sheet1.ChartObjects("Chart 1").CopyPicture
'paste it in Sheet2 A1
Sheet2.Paste Range("A1")
End Sub


--
Hope that helps.

Vergel Adriano


"KenY" wrote:

> Hi
> I have been writing a macro to process/reformat multiple data streams into a
> single table for analysis. Analysis is driven by pivot table and associated
> pivot chart. What I would like to do is to generate several chart views in
> sequence, grabbing a copy or picture of each chart to form a standard report.
>
> Problem - Excel does not allow copy/pastespecial/picture type actions on a
> PivotChart.
>
> Possible solutions with issues
> 1 It does not seem efficient to create the pivot table, pivot chart and
> then delete the associated pivot table (as I understand 'Help' to be telling
> me I should) just to get the picture.
> 2 Creating multiple instances of the pivot table with different field
> selections and a pivot chart associated with instance does not seem to
> efficient either.
>
> Can anyone suggest a better way?
>
> Thanks
> --
> KenY

 
Reply With Quote
 
=?Utf-8?B?S2VuWQ==?=
Guest
Posts: n/a
 
      19th Apr 2007
Thanks for the sample code. Sorry I have not been able to try it today, but
it is on my sheet for Friday.
--
KenY


"Vergel Adriano" wrote:

> Hi,
>
> You can copy the pivot chart as a picture in VBA. Here's an example:
>
> Sub test()
> 'copy Chart1 as picture
> Sheet1.ChartObjects("Chart 1").CopyPicture
> 'paste it in Sheet2 A1
> Sheet2.Paste Range("A1")
> End Sub
>
>
> --
> Hope that helps.
>
> Vergel Adriano
>
>
> "KenY" wrote:
>
> > Hi
> > I have been writing a macro to process/reformat multiple data streams into a
> > single table for analysis. Analysis is driven by pivot table and associated
> > pivot chart. What I would like to do is to generate several chart views in
> > sequence, grabbing a copy or picture of each chart to form a standard report.
> >
> > Problem - Excel does not allow copy/pastespecial/picture type actions on a
> > PivotChart.
> >
> > Possible solutions with issues
> > 1 It does not seem efficient to create the pivot table, pivot chart and
> > then delete the associated pivot table (as I understand 'Help' to be telling
> > me I should) just to get the picture.
> > 2 Creating multiple instances of the pivot table with different field
> > selections and a pivot chart associated with instance does not seem to
> > efficient either.
> >
> > Can anyone suggest a better way?
> >
> > Thanks
> > --
> > KenY

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      22nd Apr 2007
You could copy the pivot table, make the chart, and delete the copy of the
pivot table.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______

"KenY" <(E-Mail Removed)> wrote in message
news:69CB4A7D-AF6C-4A5F-8180-(E-Mail Removed)...
> Hi
> I have been writing a macro to process/reformat multiple data streams into
> a
> single table for analysis. Analysis is driven by pivot table and
> associated
> pivot chart. What I would like to do is to generate several chart views
> in
> sequence, grabbing a copy or picture of each chart to form a standard
> report.
>
> Problem - Excel does not allow copy/pastespecial/picture type actions on a
> PivotChart.
>
> Possible solutions with issues
> 1 It does not seem efficient to create the pivot table, pivot chart and
> then delete the associated pivot table (as I understand 'Help' to be
> telling
> me I should) just to get the picture.
> 2 Creating multiple instances of the pivot table with different field
> selections and a pivot chart associated with instance does not seem to
> efficient either.
>
> Can anyone suggest a better way?
>
> Thanks
> --
> KenY



 
Reply With Quote
 
=?Utf-8?B?S2VuWQ==?=
Guest
Posts: n/a
 
      23rd Apr 2007
Thanks - in the process of writing out my problem I thought of that approach
and have implemented that solution although it may not be the most efficient
approach - it works. I am also going to try the suggestion from Vergel
Adriano.

--
KenY


"Jon Peltier" wrote:

> You could copy the pivot table, make the chart, and delete the copy of the
> pivot table.
>
> - Jon
> -------
> Jon Peltier, Microsoft Excel MVP
> Tutorials and Custom Solutions
> http://PeltierTech.com
> _______
>
> "KenY" <(E-Mail Removed)> wrote in message
> news:69CB4A7D-AF6C-4A5F-8180-(E-Mail Removed)...
> > Hi
> > I have been writing a macro to process/reformat multiple data streams into
> > a
> > single table for analysis. Analysis is driven by pivot table and
> > associated
> > pivot chart. What I would like to do is to generate several chart views
> > in
> > sequence, grabbing a copy or picture of each chart to form a standard
> > report.
> >
> > Problem - Excel does not allow copy/pastespecial/picture type actions on a
> > PivotChart.
> >
> > Possible solutions with issues
> > 1 It does not seem efficient to create the pivot table, pivot chart and
> > then delete the associated pivot table (as I understand 'Help' to be
> > telling
> > me I should) just to get the picture.
> > 2 Creating multiple instances of the pivot table with different field
> > selections and a pivot chart associated with instance does not seem to
> > efficient either.
> >
> > Can anyone suggest a better way?
> >
> > Thanks
> > --
> > KenY

>
>
>

 
Reply With Quote
 
=?Utf-8?B?S2VuWQ==?=
Guest
Posts: n/a
 
      23rd Apr 2007
Vergel

I have tried this method, but have not been able to make it work. Could be
due to my lack of detailed knowledge of VBA as I tend to 'work from example'
even if that means recording similar code then working through the
adaptations.

I could not find the name of the chart (corresponding to your 'Chart1') so I
recorded a macro and tried replacing your statement with
ActiveChart.ChartArea.CopyPicture

This returned an error 438 - object does not support this property or method

I have solved my current problem a different way - create pivot chart then
delete the pivot table that is behind it.

Thanks
--
KenY


"Vergel Adriano" wrote:

> Hi,
>
> You can copy the pivot chart as a picture in VBA. Here's an example:
>
> Sub test()
> 'copy Chart1 as picture
> Sheet1.ChartObjects("Chart 1").CopyPicture
> 'paste it in Sheet2 A1
> Sheet2.Paste Range("A1")
> End Sub
>
>
> --
> Hope that helps.
>
> Vergel Adriano
>
>
> "KenY" wrote:
>
> > Hi
> > I have been writing a macro to process/reformat multiple data streams into a
> > single table for analysis. Analysis is driven by pivot table and associated
> > pivot chart. What I would like to do is to generate several chart views in
> > sequence, grabbing a copy or picture of each chart to form a standard report.
> >
> > Problem - Excel does not allow copy/pastespecial/picture type actions on a
> > PivotChart.
> >
> > Possible solutions with issues
> > 1 It does not seem efficient to create the pivot table, pivot chart and
> > then delete the associated pivot table (as I understand 'Help' to be telling
> > me I should) just to get the picture.
> > 2 Creating multiple instances of the pivot table with different field
> > selections and a pivot chart associated with instance does not seem to
> > efficient either.
> >
> > Can anyone suggest a better way?
> >
> > Thanks
> > --
> > KenY

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple charts from a single pivot table Yossi evenzur Microsoft Excel Charting 2 23rd Feb 2010 07:47 PM
Pivot Table View - Multiple Charts Grd Microsoft Access Queries 0 11th Jul 2008 07:41 PM
How do I create multiple pivot charts from one pivot table? =?Utf-8?B?UnVkeQ==?= Microsoft Excel Charting 1 17th Mar 2006 10:01 PM
creating pivot charts from multiple pages =?Utf-8?B?bGV3c2Nhbm5vbg==?= Microsoft Excel Programming 0 23rd May 2005 06:11 PM
Probs with creating multiple pivot charts from pivot table Retreatgal Microsoft Excel Charting 2 28th Jan 2004 02:51 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:20 AM.