Consulting

Results 1 to 2 of 2

Thread: Solved: Chart ControlTipText

  1. #1
    VBAX Mentor jammer6_9's Avatar
    Joined
    Apr 2007
    Location
    Saudi Arabia
    Posts
    318
    Location

    Solved: Chart ControlTipText

    I have created a Line Chart. In X-Axis I have 1 till 52 (As Weeks)... Once I move the mouse to certain point in the Plot Area, Controltiptext shows Series,Label
    & values.

    Is it possible change the ControlTiptext when I move or click my mouse to a certain point in the plot area?
    T-ogether
    E-veryone
    A-chieves
    M-ore


    One who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever.

  2. #2
    VBAX Mentor jammer6_9's Avatar
    Joined
    Apr 2007
    Location
    Saudi Arabia
    Posts
    318
    Location
    Below code has solved my problem. It was exactly what I wanted

    Thanks to this site Link where I also dig it from VBAX...

    http://www.computorcompanion.com/LPMArticle.asp?ID=221

    [VBA]
    Private Sub Chart_MouseUp(ByVal Button As Long, ByVal Shift As Long, _
    ByVal x As Long, ByVal y As Long)

    Dim ElementID As Long, Arg1 As Long, Arg2 As Long
    Dim myX As Variant, myY As Double

    With ActiveChart
    ' Pass x & y, return ElementID and Args
    .GetChartElement x, y, ElementID, Arg1, Arg2

    ' Did we click over a point or data label?
    If ElementID = xlSeries Or ElementID = xlDataLabel Then
    If Arg2 > 0 Then
    Extract x value from array of x values
    myX = WorksheetFunction.Index _
    (.SeriesCollection(Arg1).XValues, Arg2)
    Extract y value from array of y values
    myY = WorksheetFunction.Index _
    (.SeriesCollection(Arg1).Values, Arg2)

    ' Display message box with point information
    MsgBox "Series " & Arg1 & vbCrLf _
    & """" & .SeriesCollection(Arg1).Name & """" & vbCrLf _
    & "Point " & Arg2 & vbCrLf _
    & "X = " & myX & vbCrLf _
    & "Y = " & myY
    End If
    End If
    End With

    End Sub
    [/VBA]
    T-ogether
    E-veryone
    A-chieves
    M-ore


    One who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •