How do I change the font properties of chart axes in Excel 2007 & 2010?
NOT the axis title; that one's easy. I'm asking about the font of the axis itelf.
It records equivalent to this in Excel 2010:
shEditSizeScales.ChartObjects("MyChart").Chart.Axes(xlCategory).Format.TextFrame2.TextRange.Font.Size=12
But I get an error on that, and I don't see anything past TextFrame2 in the Watch pane.
Even if I step through the recorded code, it gives me the same error.
I've looked through the object model and I don't see it.
How is it done?
To change the text font for any chart element, such as a title or axis, right–click the element, and then click Font. When the Font box appears make the changes you want.
Right-click the category axis labels you want to format, and click Font. On the Font tab, choose the formatting options you want.
Use new text for category labels in the chart and leavesource data text unchanged. Right-click the category labels to change, and click Select Data. In Horizontal (Category) Axis Labels, click Edit. In Axis label range, enter the labels you want to use, separated by commas.
Use this:
With ActiveChart.Axes(xlCategory).TickLabels.Font
'.Bold = msoTrue
.Size = 18
End With
Source: MS Ref link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With