Microsoft Office Tutorials and References
In Depth Information
Discovering VBA Charting Tricks
Figure 18-19: A text box displays information about the data point under the mouse pointer.
This procedure monitors all mouse movements on the Chart sheet. The mouse coordinates are
contained in the X and Y variables, which are passed to the procedure. The Button and Shift
arguments aren’t used in this procedure.
As in the previous example, the key component in this procedure is the GetChartElement
method. If ElementId is xlSeries , the mouse pointer is over a series. The TextBox is made
visible and displays the text in a particular cell. This text contains descriptive information about
the data point (see Figure 18-20). If the mouse pointer isn’t over a series, the text box is hidden.
The example workbook also contains a Chart_Activate event procedure that turns off the
normal ChartTip display, and a Chart_Deactivate procedure that turns the settings back on.
The Chart_Activate procedure is:
Private Sub Chart_Activate()
Application.ShowChartTipNames = False
Application.ShowChartTipValues = False
End Sub
Search JabSto ::

Custom Search