Excel VBA:是否只有VBA才能格式化图表轴?

[英]Excel VBA: Is there any way to format chart axes through VBA only?


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?

我只需要用VBA做Excel表格(不需要用户输入)。我想要格式化x轴的标签,这样每个标签的对齐就变成-270度。(这可以通过在“格式轴”对话框的“对齐”选项卡中更改“自定义角度”属性来手动完成。)我尝试过录制一个宏,但是Excel似乎没有记录对齐步骤。有人知道怎么用VBA做这个吗?

2 个解决方案

#1


4  

If you are using Excel 2007, try using an earlier version because 2007's macro recorder is a bit crippled.

如果您正在使用Excel 2007,请尝试使用较早的版本,因为2007的宏记录器有点残废。

This is what I got:

这就是我得到的:

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.Orientation = xlUpward

#2


1  

ActiveChart.Axes(xlCategory).TickLabels.Orientation = 67
智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2009/01/05/54ceb08754f8cb98a2b961d235c1b328.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告