I know how to set the size of the diagram, but I cannot find the option for setting the size of the chart area
(not sure if this is the correct name in English). The box I want to change is marked with a red arrow in the figure below.
2 Answers
With VBA, assuming you set:
Set myChart = ActiveSheet.ChartObjects(1)
Then you can use:
myChart.Chart.PlotArea.Height = desired width
or:
myChart.Chart.PlotArea.Width = desired height
If you want to enlarge the plot area to a value greater than the current chart area, you will need to enlarge the latter first, using:
myChart.Chart.ChartArea.Height = desired height
myChart.Chart.ChartArea.Width = desired width
-
That;s the plot area, but the rectangle is really the plot "inside" area, and the plot area includes a margin that has room for axis labels etc. You can change the plot area in code, not the plot inside area, so you need to do a little algebra in your code to make it work out. Commented Nov 2, 2018 at 2:19
The easiest (non-VBA) way I know to do this is:
- Build your chart
- Select
Page Layout
fromView
>Workbook Views
. This will let you set your dimensions in "real" units (e.g. inches, mm). - Adjust your column width and row height to the required size.
- Select
Snap to Grid
fromPage Layout
>Arrange
>Align
- Arrange your chart so that the
Chart Area
snaps to a cell of the required dimensions.
-
1