excel charts

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top