我有一个图表(由VBA中的Userform生成),同时存在主要和辅助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
HELP !!!!拜托,我将非常感谢您的帮助!谢谢
答案 0 :(得分:1)
如果您的图表已经配置了Seconday 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