ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Making charts (https://www.excelbanter.com/excel-programming/365768-making-charts.html)

Fabrizio

Making charts
 
I am writing a macro that creates several charts. Now I want to be able to
assign the size of the charts (as well as the size of e.g. the plot area) in
the code so that the charts will be exactly the same size. How do you write
the code for this? When recording a macro for this I just get code that
changes the size from some default setting but how do you decide the size
directly?





[email protected]

Making charts
 
Hi
This is similar to setting the position of the chart

Set myChart = ChartObjects("Datachart")
With myChart.Parent
.Width = Range("C2:M2").Width
.Height = Range("C2:C10").Height
end with

or use absolute measurements instead of the range references. Of
course, you can combine postion and size inside the with...end with. I
would let the plot area take care of itself as there are usually
headings and series labels to fit on?

regards
Paul


Fabrizio wrote:
I am writing a macro that creates several charts. Now I want to be able to
assign the size of the charts (as well as the size of e.g. the plot area) in
the code so that the charts will be exactly the same size. How do you write
the code for this? When recording a macro for this I just get code that
changes the size from some default setting but how do you decide the size
directly?




All times are GMT +1. The time now is 03:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com