LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default setting chart axes

Aja -

Let's try it another way. I think you are running out of chartobjects.

Sub macrotitlesize()
dim cho as chartobject
For each cho in activesheet.chartobjects
With cho.Chart
.Axes(xlCategory).MajorUnitScale = xlYears
.Axes(xlCategory).MinorUnitScale = xlMonths
.Axes(xlCategory).Crosses = xlCustom
.Axes(xlCategory).AxisBetweenCategories = True
.Axes(xlCategory).ReversePlotOrder = False
.Axes(xlCategory).MinimumScale = "1/1/2000"
.Axes(xlCategory).MaximumScaleIsAuto = True
.Axes(xlCategory).MajorUnit = 1
.Axes(xlCategory).MinorUnitIsAuto = True
.Axes(xlCategory).MinorUnit = 1
.Axes(xlCategory).CrossesAt = "1/1/2000"
End With
Next
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Aja wrote:

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code about setting Y Axes scale. fujing1003[_2_] Charts and Charting in Excel 3 December 11th 07 11:29 AM
Having two X-axes on same chart Boon8888 Excel Discussion (Misc queries) 1 March 23rd 06 08:49 PM
Setting axes for 3-dimensional charts owc Charts and Charting in Excel 0 March 17th 06 07:20 PM
XY-Chart with 4 axes monir Charts and Charting in Excel 3 December 3rd 05 09:57 PM
setting chart axes nath Excel Programming 0 July 14th 04 10:59 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"