Excel VBA: Is there any way to format chart axes through VBA only?
Question
I have to make column charts in Excel using VBA only (no user input). I wanted to format the labels of the x-axis so that the alignment for every label becomes -270 degrees. (This can be done manually by changing the "Custom angle" property in the "Alignment" tab of the "Format Axis" Dialog.) I have tried recording a macro for this but Excel does not seem to be recording the alignment step. Does anybody know how to do this with VBA only?
Solution
If you are using Excel 2007, try using an earlier version because 2007's macro recorder is a bit crippled.
This is what I got:
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.Orientation = xlUpward
OTHER TIPS
ActiveChart.Axes(xlCategory).TickLabels.Orientation = 67
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow