Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

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

ResolvedVersion 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:

Use VbNullString instead of

When needing to default a String variable back to it's default of "" use vbNullString as in the following example:

Sub ClearText()

Dim strEmpName As String

strEmpName = "John Smith"
MsgBox strEmpName

strEmpName = vbNullString
MsgBox strEmpName

End Sub

View all VBA hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.