zooms in on a left mouse click and zooms out on a right mouse click. : Chart Event « Excel « VBA / Excel / Access / Word






zooms in on a left mouse click and zooms out on a right mouse click.

 
Private Sub MyChartClass_MouseDown(ByVal Button As Long, ByVal Shift _
    As Long, ByVal x As Long, ByVal y As Long)
    If Button = 1 Then
        ActiveChart.Axes(xlValue).MaximumScale = ActiveChart.Axes(xlValue).MaximumScale - 50
    End If
    If Button = 2 Then
       ActiveChart.Axes(xlValue).MaximumScale = ActiveChart.Axes(xlValue).MaximumScale + 50
    End If
End Sub

 








Related examples in the same category

1.Understanding Chart Events
2.Chart_Deactivate procedure also displays a message only when the chart sheet is deactivated:
3.The Chart_Select procedure listed next is executed whenever an item on the chart is selected:
4.Events with Chart Sheets
5.Events with Embedded Charts
6.Chart double click event
7.hides the legend when it is double-clicked; double-clicking either axis brings back the legend:
8.Embedded Chart Mouse Events