coordinate of cursor on a chart

A

AA2e72E

Is there a way to:

1. Get something like a tooltip message to come up when the mouse cursor
hovers over a chart? The message itself should give the coordinates of the
cursor head.

2. If 1 is impossible: if I specify the x,y coordinate in two cells, is
there a way whereby I can get that point to show on an existing chart?

Thanks for your help.
 
D

David Biddulph

For an answer to your question 2, copy the xy co-ords, and paste special
into your chart as a new series.
 
P

PBezucha

Hi,
(2) As there are usually several such points that should be marked, the
following procedure appered many times invaluable:

Sub MarkerColor()

'(e-mail address removed)
'Sub changes the colors of individual markers in the selected series
'of x-y chart into the colors of the fonts of parent cell v a l u e s.
'It keeps the marker interior the way as defined for the whole series:
'either empty, or of uniform color. If, however, the background
'of any value cell is light gray, the interior of corresponding
'marker changes into its opposite, i.e. if the series has been declared
'as marker full then such a marker turns to empty and vice versa.
'If the cell background is medium gray, the marker optically disappears.
'The aim is to identify individual markers or their groups within
'one complete series on an x-y chart without having to decompose
'the parent range into subranges.

Dim SP As Points, W As Range
Dim ErrMsg As String, SPF As String, Rng As String
Dim I As Long, N As Long, PosComma As Long, ICI As Long, FCI As Long
Dim MarkersAreEmpty As Boolean

Const Comma = ",", LightGray = 15, MediumGray = 48

ErrMsg = "No series has been selected"
On Error GoTo ErrExit
Set SP = Selection.Points
MarkersAreEmpty = Selection.MarkerBackgroundColorIndex = xlNone
N = SP.Count
SPF = SP.Parent.Formula
I = 3
Do
I = I + 1
Rng$ = Right(SPF, I)
Loop Until Left(Rng, 1) = "!"
Rng = Right(Rng, Len(Rng) - 1)
PosComma = Application.WorksheetFunction.Search(Comma, Rng)
Rng = Left(Rng, PosComma - 1)
Set W = Range(Rng)
For I = 1 To N
FCI = W.Cells(I).Font.ColorIndex
On Error GoTo Skip
SP(I).MarkerForegroundColorIndex = FCI
ICI = W.Cells(I).Interior.ColorIndex
If ICI = LightGray Then
If MarkersAreEmpty Then
SP(I).MarkerBackgroundColorIndex = FCI
Else
SP(I).MarkerBackgroundColorIndex = xlNone
End If
ElseIf ICI = MediumGray Then
SP(I).MarkerForegroundColorIndex = xlNone
SP(I).MarkerBackgroundColorIndex = xlNone
Else
If Not MarkersAreEmpty Then
SP(I).MarkerBackgroundColorIndex = FCI
Else
SP(I).MarkerBackgroundColorIndex = xlNone
End If
End If
Skip:
Next I
Resume Next
Exit Sub

ErrExit:
MsgBox ErrMsg$
On Error GoTo 0
End Sub

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top