Align x axis labels at 45 degrees using vba, please help!


Mark Stephens

Been trying to figure out how to do this for hours now I have run out of ideas.

I have managed to select the labels using the following code:

' add the chart
Set myChtObj = ActiveSheet.ChartObjects.Add(Left:=300, Width:=800, Top:=75 Height:=400)

With myChtObj.Chart
.Axes(xlCategory).TickLabelPosition = xlTickLabelPositionLow
End With

My usual way to find out how to do stuff like this is to record a macro then look at the code but the macro is not picking it up at all.

I checked the VBA help and it helpfully gives the syntax as follows:

TickLabels.Alignment Property (Excel)

Returns or sets a Long value that represents the alignment for the specified phonetic text or tick label.



expression A variable that represents a TickLabels object.

See Also


TickLabels Object
TickLabels Object Members

Only problem is (not so helpfully!) it does not work!!!

It may be that this is a bug in the pprograme, which would be a shame as I really want my chart a certain way and to build it with code, if anyone hasany knowledge of how to do it or get round it or even knows for sure it isimpossible I would be very grateful.

Kind regards, Mark


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