|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
请高手帮忙看一下下面这段代码为何无效,谢谢。
目的是采用换算的办法使次坐标轴零值与横坐标交叉。
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
|
|