ExcelBanter

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

travis

excel charts
 
Hi,

Does anyone have a code snippet that for multiple charts on a worksheet,
forces the Chart Area and Plot Area to be the same across each chart?

Thanks,

Travis

K Dales[_2_]

excel charts
 
This requires you to supply the parameters: name of the sheet where the
charts are, desired width of the chart area, desired height, left offset of
the plot area (distance from left edge of chart area), top offset, width and
height of the plot area.

If you don't want to have to figure the parameters you could modify the code
to read the values from one of the charts.

Public Sub MakeSame(SheetName As String, CWidth As Double, CHeight As
Double, PLeft As Double, PTop As Double, PWidth As Double, PHeight As Double)

Dim CO As ChartObject

For Each CO In Sheets(SheetName).ChartObjects
CO.Width = CWidth
CO.Height = CHeight
With CO.Chart
.PlotArea.Left = PLeft
.PlotArea.Top = PTop
.PlotArea.Width = PWidth
.PlotArea.Height = PHeight
End With
Next CO

End Sub


"Travis" wrote:

Hi,

Does anyone have a code snippet that for multiple charts on a worksheet,
forces the Chart Area and Plot Area to be the same across each chart?

Thanks,

Travis



All times are GMT +1. The time now is 08:19 PM.

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