I am writing a macro to change the font and size of the axis, axis titles, legend, etc. in my excel chart. Here is what I have so far:
Code
Sub EditPlots()
'
' EditPlots Macro
'
'Selects Chart
Sheets("Chart1").Select
'Selects Primary Vertical Axis and changes font to Arial and size to 14
ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Select
Selection.Font.Name = "Arial"
Selection.Font.Size = 14
'Selects Secondary Vertical Axis and changes font to Arial and size to 14
ActiveChart.Axes(xlValue, xlSecondary).AxisTitle.Select
Selection.Font.Name = "Arial"
Selection.Font.Size = 14
'Selects Primary Horizontal Axis and changes font to Arial and size to 14
ActiveChart.Axes(xlCategory).AxisTitle.Select
Selection.Font.Name = "Arial"
Selection.Font.Size = 14
'Selects Legend and changes font to Arial and size to 12
ActiveChart.Legend.Select
Selection.Font.Name = "Arial"
Selection.Font.Size = 12
ActiveChart.Axes(xlCategory).Select
[B]'***Here is where it stops working, and I don't know why...***[/B]
Selection.Font.Name = "Arial"
Selection.Font.Size = 12
ActiveChart.Axes(xlCategory, xlPrimary).Select
Selection.Font.Name = "Arial"
Selection.Font.Size = 12
'
End Sub
Display More
Once the code gets to the point of changing the size and font of the numbers on the horizontal axis it crashes. See code above, I have put in notation where it stops working. Any help would be greatly appreciated.