Resize Chart Area in 2010 Excel VBA

rathalex

New Member
Joined
Oct 25, 2017
Messages
32
Hello

Im trying to resize the chart area width and height using vba,but keep getting “shape is locked and cannot be resized” error.
I am using basic commands such as:

With ActiveChart
.ChartArea.Height = 200
.ChartArea.Width= 50
End With

Any way to work around this lock error?

Thank you
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
HTH. Dave
'size chart
Code:
Dim CurrentChart As Chart
Set CurrentChart = Sheets("Sheet1").ChartObjects(1).Chart
CurrentChart.Parent.Width = 50
CurrentChart.Parent.Height = 200
There's a plotarea as well...
Code:
With Sheets("Sheet1").ChartObjects(1).Chart.PlotArea
.Width = 50
.Height = 200
.Top = 20  'apply plot area distance from top of chart
.Left = 15  'apply plot area distance from left of chart
End With
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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