Forum Discussion
Mike Curnow
Aug 24, 2018Copper Contributor
How to Resize Excel Plot Area
Hi, I have a Bubble Chart where I am plotting a value (Z) against X/Y co-ordinates. I need to make the X & Y axis the same scale, i.e. I need to size the Plot Area so that the co-ordinates map onto ...
- Aug 24, 2018
Sub plotplot()
Dim w As Variant
Dim h As Variant
Dim crt_name As Variant
w = InputBox("Width in cm")
h = InputBox("Height in cm")
crt_name = InputBox("Chart name")
ActiveSheet.ChartObjects(crt_name).Activate
ActiveChart.PlotArea.Select
Selection.Width = Application.CentimetersToPoints(w)
Selection.Height = Application.CentimetersToPoints(h)
End SubThis should do what you want.. if you add it as module and run it you should be asked for 3 things.. width in cm, height in cm and the chart name. You should be able to find the chart name by clicking it and the going to the Chart tools->layout ribbon. Default is Chart 1, Chart 2 etc.
Normal warnings, make sure you have a saved copy of your workbook before trying this, you cant undo actions taken by VBA..
Hope it does what you want.