vba courses london - graphics vba

Forum home » Delegate support and help forum » Microsoft VBA Training and help » vba courses london - Graphics in VBA

vba courses london - Graphics in VBA

resolvedResolved · Low Priority · Version Standard

Nicola has attended:
Excel VBA Intro Intermediate course

Graphics in VBA

When you have made a pivot table for multiple choices. how do you change the sourced data to a chart rather than a pivot table?

Thanks

Edited on Fri 26 Jan 2007, 10:19

RE: Graphics in VBA

A pivot chart is always created together with a Pivot Table.

If you have created a Pivot Table using VBA code you can do the following:

Add the following code to the end of the routine creating the Pivot Table

OR

Create a separate routine wheck can be called when needed.

Sub CreatePivotChart()

Charts.Add After:=Worksheets("Sales Summary")

'Set the source data by pionting to one of the cells in the Pivot Table
ActiveChart.SetSourceData Source:=Sheets("Sales Summary").Range("A12")

ActiveChart.Location Where:=xlLocationAsNewSheet

ActiveChart.Name = "Pivot Chart"
'If you name the chart as above make sure you check if a chart exists and delete it before creating a new one

End Sub

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

VBA tip:

Stop Display Alerts In Excel

When creating or deleting a Worksheet in Excel you don't want Excel to inform you "A file already exists....." Or "Do you want to save this file...".

To stop these alerts happening use the following line of code:

Application.DisplayAlerts = False

After the Create or Delete routine use:

Application.DisplayAlerts = True

View all VBA hints and tips


Server loaded in 0.05 secs.