Search code examples
excelvbavstoexcel-2007

How to change axis value labels orientation?


I have a chart in Excel; I need to change orientation of text labels in one of the axis programmatically. Ideas?


Solution

  • This will change the orientation of the X-axis tick labels.

    ActiveChart.Axes(xlCategory).TickLabels.Orientation = 45 ' degrees
    

    This is how to change the orientation of the axis title:

    ActiveChart.Axes(xlCategory).AxisTitle.Orientation = 81 ' degrees
    

    Have you ever tried recording macros? If not, you should! Looking at the resulting code is a great way to quickly learn this type of thing.