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

charts

ResolvedVersion 2003

Melanie has attended:
Excel Advanced course
Excel VBA Intro Intermediate course

Charts

We learnt how to create pivot tables through the back-end coding. Is it also possible to create charts? What is the best way to do this?

RE: Charts

Hi Melanie,

Thank you for your question and sorry for the delay in responding.

Please find the chart code below:


Sub ColumnClustered()

Dim aChart As Chart

Set aChart = Charts.Add
Set aChart = aChart.Location(Where:=xlLocationAsObject, Name:="Basic Concepts")

Sheets("Basic Concepts").Select


With aChart

.ChartType = xlColumnClustered
.SetSourceData Source:=Sheets("Basic Concepts").Range("F1").CurrentRegion
.HasTitle = True
.ChartTitle.Text = "items per line"

With .Parent

.Top = Range("F14").Top
.Left = Range("F14").Left
.Name = "ItemsPerLine"

End With


End With

ActiveSheet.Shapes(1).Width = 1000
ActiveSheet.Shapes(1).Width = 500

End Sub

I hope this helps.

Regards

Simon

 

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.

Excel tip:

Get back to active cell

If you have scrolled away from the active celland want to get back t it quicly you can Ctrl and Backspace to get back

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.