VBA to set the font size for the axes of a bar chart

H

Harry Flashman

I trying to set the font size on the axes of a horizontal stacked bar
chart (Excel 2010). When I try to run the code created by the macro
recorder I get an error message: Method of 'TextFrame2' of object
'ChartFormat' failed

Here is the offending code:

ActiveChart.Axes(xlValue).Select
Selection.Format.TextFrame2.TextRange.Font.Size = 10

Can anyone tell me how to set the font size of the chart axes with VBA
please?
Any help would be greatly appreciated.
 
H

Harry Flashman

I trying to set the font size on the axes of a horizontal stacked bar
chart (Excel 2010). When I try to run the code created by the macro
recorder I get an error message: Method of 'TextFrame2' of object
'ChartFormat' failed

Here is the offending code:

ActiveChart.Axes(xlValue).Select
    Selection.Format.TextFrame2.TextRange.Font.Size = 10

Can anyone tell me how to set the font size of the chart axes with VBA
please?
Any help would be greatly appreciated.

Okay I am an idiot. After struggling with this problem for over an
hour I post here and then exactly 2 minutes later I figure it out.


ActiveChart.Axes(xlValue).TickLabels.Font.Size = 10
ActiveChart.Axes(xlCategory).TickLabels.Font.Size = 8
 

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

Top