ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   setting chart axes (https://www.excelbanter.com/excel-programming/304037-setting-chart-axes.html)

nath

setting chart axes
 

-----Original Message-----
I am attempting to give all of my charts the same scale

and font size using a Macro. When I attempt to run the
following code, it breaks after a few iterations and then
says that it is 'Unable to get the chartobjects property
of the worksheetclass'
What's wrong?

Sub macrotitlesize()
For i = 0 To 12
ActiveSheet.ChartObjects(i + 1).Activate
ActiveChart.Axes(xlCategory).MajorUnitScale = xlYears
ActiveChart.Axes(xlCategory).MinorUnitScale = xlMonths
ActiveChart.Axes(xlCategory).Crosses = xlCustom
ActiveChart.Axes(xlCategory).AxisBetweenCategories =

True
ActiveChart.Axes(xlCategory).ReversePlotOrder = False
ActiveChart.Axes(xlCategory).MinimumScale = "1/1/2000"
ActiveChart.Axes(xlCategory).MaximumScaleIsAuto = True
ActiveChart.Axes(xlCategory).MajorUnit = 1
ActiveChart.Axes(xlCategory).MinimumScale = "1/1/2000"
ActiveChart.Axes(xlCategory).MaximumScaleIsAuto = True
ActiveChart.Axes(xlCategory).MinorUnitIsAuto = True
ActiveChart.Axes(xlCategory).MinorUnit = 1
ActiveChart.Axes(xlCategory).CrossesAt = "1/1/2000"
Next i
End Sub

.Try for each cht in activesheet.chartobjects for the

start of your for next loop. then use activesheet.chart
(cht).

I think that should help any probs drop another post on
this and address it to me and i'll look a little deeper
into it.

Nath





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

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