I have a chart in Excel; I need to change orientation of text labels in one of the axis programmatically. Ideas?
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.
Layout tab (which appears when you have a chart selected) -> labels -> axis titles.
or
Right click the chart axis -> format axis -> Alignment
or
VBA solution as Jean-François Corbett pointed out
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