Chart 方法 (Excel)Chart.Axes method (Excel)

返回一个代表图表上单个坐标轴或坐标轴集合的某个对象。Returns an object that represents either a single axis or a collection of the axes on the chart.


表达式(TypeAxisGroup)expression.Axes (Type, AxisGroup)

expression:一个表示 Chart 对象的变量。expression A variable that represents a Chart object.


名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
TypeType 可选Optional VariantVariant 指定要返回的轴。Specifies the axis to return. 可以是下列的**XlAxisType** 常量之一: xlValuexlCategoryxlSeriesAxis (xlSeriesAxis仅对三维图表有效)。Can be one of the following XlAxisType constants: xlValue, xlCategory, or xlSeriesAxis (xlSeriesAxis is valid only for 3D charts).
AxisGroupAxisGroup 可选Optional XlAxisGroupXlAxisGroup 指定坐标轴组。Specifies the axis group. 如果省略该参数,则使用主坐标轴组。If this argument is omitted, the primary group is used. 三维图表只有一个坐标轴组。3D charts have only one axis group.

返回值Return value



本示例为 Chart1 的分类轴添加坐标轴标签。This example adds an axis label to the category axis on Chart1.

With Charts("Chart1").Axes(xlCategory) 
 .HasTitle = True 
 .AxisTitle.Text = "July Sales" 
End With

本示例关闭 Chart1 中分类轴的主要网格线。This example turns off major gridlines for the category axis on Chart1.

Charts("Chart1").Axes(xlCategory).HasMajorGridlines = False

本示例关闭 Chart1 上所有坐标轴的所有网格线。This example turns off all gridlines for all axes on Chart1.

For Each a In Charts("Chart1").Axes 
 a.HasMajorGridlines = False 
 a.HasMinorGridlines = False 
Next a

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.