Chart.MouseMove Event (Excel)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Occurs when the position of the mouse pointer changes over a chart.

expression .MouseMove(Button, Shift, x, y)

expression A variable that represents a Chart object.

Parameters

Name

Required/Optional

Data Type

Description

Button

Required

Long

The mouse button that was released. Can be one of the following XlMouseButton constants: xlNoButton, xlPrimaryButton, or xlSecondaryButton.

Shift

Required

Long

The state of the SHIFT, CTRL, and ALT keys when the event occurred. Can be one of or a sum of values.

x

Required

Long

The X coordinate of the mouse pointer in chart object client coordinates.

y

Required

Long

The Y coordinate of the mouse pointer in chart object client coordinates.

Return Value

Nothing

The following table specifies the values for the Shift parameter.

Value

Meaning

0 (zero)

No keys

1

SHIFT key

2

CTRL key

4

ALT key

This example runs when the position of the mouse pointer changes over a chart.

Private Sub Chart_MouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long) 
 MsgBox "X = " & X & " Y = " & Y 
End Sub

Concepts

Other resources

Show: