|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
请高手帮忙看一下下面这段代码为何无效,谢谢。
目的是采用换算的办法使次坐标轴零值与横坐标交叉。
Private Sub Worksheet_Change(ByVal Target As Range)
Dim a1, a2, b1, b2
Sheets("sheet2").Select
ActiveSheet.ChartObjects("图表 7").Activate
ActiveChart.Axes(xlValue).Select
ActiveChart.Axes(xlValue).MaximumScaleIsAuto = True
ActiveChart.Axes(xlValue).MinimumScaleIsAuto = True
ActiveChart.Axes(xlValue, xlSecondary).Select
ActiveChart.Axes(xlValue, xlSecondary).MaximumScaleIsAuto = True
Range("a2") = ActiveChart.Axes(xlValue).MinimumScale.Value
Range("a1") = ActiveChart.Axes(xlValue).MaximumScale.Value
Range("b2") = ActiveChart.Axes(xlValue, xlSecondary).MinimumScale.Value
Range("b1") = ActiveChart.Axes(xlValue, xlSecondary).MaximumScale.Value
Range("b2") = Range("a2") * Range("b1") / Range("a1")
ActiveChart.Axes(xlValue, xlSecondary).Select
ActiveChart.Axes(xlValue, xlSecondary).MinimumScale = Range("b2").Value
ActiveChart.Axes(xlValue).MinimumScale = Range("a2")
ActiveChart.Axes(xlValue).MaximumScale = Range("a1")
ActiveChart.Axes(xlValue, xlSecondary).MaximumScale = Range("b1")
End Sub
|
|