次轴上的网格线
Gridlines on Secondary axis
我有一个图表(由 VBA 中的用户窗体生成),其中存在主要和次要 y 轴。我希望只在次轴上放置网格线,而主轴上的网格线不存在!我该怎么做(??),此时主 y 轴和次 y 轴均出现网格线。这是我使用的代码:
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "title"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Dates"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Dollar"
.Axes(xlValue, xlPrimary).TickLabels.NumberFormat = "0"
.Axes(xlCategory).HasMajorGridlines = True
.Axes(xlValue, xlSecondary).HasMinorGridlines = True
.Legend.Position = xlLegendPositionRight
End With
求助!!!!请在这里提供任何帮助,我将不胜感激!谢谢
如果您的图表已经配置了辅助 Y 轴,那么您需要在 With
语句中添加以下 2 行:
With ActiveChart
' do all your regular actions
' hide Primary Y-Axis Gridlines
.SetElement (msoElementPrimaryValueGridLinesNone)
' Show Secondary Y-Axis Gridlines (Major)
.SetElement (msoElementSecondaryValueGridLinesMajor)
End With
我有一个图表(由 VBA 中的用户窗体生成),其中存在主要和次要 y 轴。我希望只在次轴上放置网格线,而主轴上的网格线不存在!我该怎么做(??),此时主 y 轴和次 y 轴均出现网格线。这是我使用的代码:
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "title"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Dates"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Dollar"
.Axes(xlValue, xlPrimary).TickLabels.NumberFormat = "0"
.Axes(xlCategory).HasMajorGridlines = True
.Axes(xlValue, xlSecondary).HasMinorGridlines = True
.Legend.Position = xlLegendPositionRight
End With
求助!!!!请在这里提供任何帮助,我将不胜感激!谢谢
如果您的图表已经配置了辅助 Y 轴,那么您需要在 With
语句中添加以下 2 行:
With ActiveChart
' do all your regular actions
' hide Primary Y-Axis Gridlines
.SetElement (msoElementPrimaryValueGridLinesNone)
' Show Secondary Y-Axis Gridlines (Major)
.SetElement (msoElementSecondaryValueGridLinesMajor)
End With