+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    05-29-2009
    Location
    TX,US
    MS-Off Ver
    Excel 2003
    Posts
    1

    Return series point data value

    Hello all. I am using chart events to highlight a series collection in a chart when the the mouse is clicked on a legend entry (courtesy of Peltiertech.com). In addition to highlighting the series I am also trying to find the maximum value in the highlighted series and add a label or highlight that point. I am a novice so I really just hope and poke around until I get it right. I am having problems returning the y axis value of a data point and was hoping someone could nudge me in the right direction. I have tried the following with many variations:

    Code:
    Private Sub FindMaxSeriesData()
    
    Dim fmSeriesCount, old
    
    fmSeriesCount = Me.SeriesCollection(Arg1).Points.Count
    maxDataPoint = fmSeriesCount
    old = fmSeriesCount
    Do
      fmSeriesCount = fmSeriesCount - 1
    
      'Here is where I am having problems. I do not know how to return the value of the point.
      If Me.SeriesCollection(Arg1).Points(fmSeriesCount).curryvalue > _
        Me.SeriesCollection(Arg1).Points(old).curryvalue Then
        
        maxDataPoint = fmSeriesCount
      End If
    Loop While fmSeriesCount <> 0
      
    End Sub
    Last edited by mchristisen; 05-29-2009 at 12:19 PM.

  2. #2
    Forum Guru mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2007/2010
    Posts
    2,814

    Re: Return series point data value

    As you presumably know the range of the source data, you should be able to deduce which row in this range is linked to the point in question based upon its index number.
    Martin

    Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.

    If my solution has saved you time and/or money, please consider donating to Cancer Research UK.

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003 & 2007 & 2010
    Posts
    10,944

    Re: Return series point data value

    This will return the maximum value.

    Code:
    msgbox application.WorksheetFunction.Max(activechart.SeriesCollection(Arg1).values)
    this will loop through the values
    Code:
    for each vntValue in activechart.SeriesCollection(1).values: debug.Print vntValue: next vntvalue
    Cheers
    Andy
    www.andypope.info

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0