vba 如何更改轴值标签方向?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6303794/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 11:34:17  来源:igfitidea点击:

How to change axis value labels orientation?

excelvbavstoexcel-2007

提问by user626528

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

我有一个 Excel 图表;我需要以编程方式更改其中一个轴中文本标签的方向。想法?

回答by Jean-Fran?ois Corbett

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

这将更改 X 轴刻度标签的方向。

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.

你有没有试过录制宏?如果没有,你应该!查看生成的代码是快速学习此类事情的好方法。

回答by Alen

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

Jean-Fran?ois Corbett 指出的 VBA 解决方案