VBA Chart problem

ph03

New Member
Joined
Jun 17, 2011
Messages
7
Has anyone had a problem with adding an embedded chart using VBA syntax in the 2010 version? My syntax is below, the macro stalls on line 2.

Range("A1:E5").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Range("Table!$A$1:$E$5")
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Try like this

Code:
Sub AddChart()
Dim ChtObj As ChartObject
Set ChtObj = ActiveSheet.ChartObjects.Add(Left:=250, Width:=375, Top:=75, Height:=225)
With ChtObj.Chart
    .ChartType = xlColumnClustered
    .SetSourceData Source:=Sheets("Table").Range("A1:E5")
End With
End Sub
 
Upvote 0
Thanks so much for your response! It's still not working which make me think I may need to reinstall my Excel program. Do you have the 2010 version?
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top