我已经为 Excel 中的图表编写了放大功能,但我不知道如何使用滚动条值进行缩小。
有谁能够帮助我?
Private Sub Zoom_X_Change1()
With ActiveSheet.ChartObjects("Chart 20").Chart
If (.Axes(xlCategory).MinimumScale >= 0) And (.Axes(xlCategory).MinimumScale < 0.4) Then
.Axes(xlCategory).MinimumScale = .Axes(xlCategory).MinimumScale + 0.1
End If
If (.Axes(xlCategory).MaximumScale > 0.6) And (.Axes(xlCategory).MaximumScale <= 1) Then
.Axes(xlCategory).MaximumScale = .Axes(xlCategory).MaximumScale - 0.1
End If
End With
End Sub
滚动:
Dim aX As Integer
Dim aY As Integer
Dim arrScale As Variant
Private Sub Scale_X_Change()
arrScale = Array(-0.5, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11)
aX = arrScale(Scale_X.Value - 1)
With ActiveSheet.ChartObjects("Chart 20").Chart
.Axes(xlCategory).MinimumScale = 0
.Axes(xlCategory).MaximumScale = aX
End With
End Sub