VBA - Moving and resizing chart

Hi Guys,

I have the code below which will create a chart based on a template. This works fine however the chart when enbedded on the worksheet is too small and in the wrong position.
Is there a way using VBA code to resize the chart and also move it to the correct position on the sheet. Also, the title and vertical axis comes out empty. I can set the title as seen below but can't work out how to set the vertical axis title

ActiveChart.setSourceData Source:=Range("'Quality'!$A$19:$D$28")
ActiveChart.ChartTitle.Text = "Quality"

Thanks heaps

Who is Participating?

try something like

Dim TopLeftCell     As Range
Dim chtChtObj       As ChartObject
Dim Sht             As Worksheet

Set Sht = ActiveSheet
Set TopLeftCell = Sht.Range("a1")

Set chtChtObj = Sht.ChartObjects.Add(TopLeftCell.Left + 2, TopLeftCell.Top + 2, 400, 200)

chtChtObj.Chart.SetSourceData Range("'Quality'!$A$19:$D$28")

With chtChtObj.Chart
    .ApplyChartTemplate ("Quality.crtx")
    If Not .HasTitle Then .HasTitle = True
    .ChartTitle.Text = "Quality"
    If Not .Axes(2, xlPrimary).HasTitle Then .Axes(2, xlPrimary).HasTitle = True
    .Axes(2, xlPrimary).AxisTitle.Text = "My Title"
End With

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.