+ Reply to Thread
Results 1 to 2 of 2

Accessing values in points collection of chart & conditional display

  1. #1
    Registered User
    Join Date
    08-03-2005
    Posts
    1

    Question Accessing values in points collection of chart & conditional display

    Hi,
    I have just started learning Macros &...

    I need to read thru the values of each data point in a chart and decide if the datalabels need to be displayed on the chart.
    That is, if the value in a point is less than 1, I do not want the datalabel displayed for that point.
    Is there a way to access the Value of the points array ?
    Please help.
    I duno in which group the Points belong to . This is how I started working on it.

    Dim p As Points
    With ActiveChart
    For Each p In ??
    If p.Values <= 1 Then
    p.HasDataLabels = False
    End If
    Next p
    End With

    Thanx in advance

  2. #2
    Jon Peltier
    Guest

    Re: Accessing values in points collection of chart & conditionaldisplay

    Sub LabelsIfGreaterThanOne()
    Dim vaValues As Variant
    Dim iPt As Long
    With ActiveChart.SeriesCollection(1)
    vaValues = .Values
    For iPt = 1 To .Points.Count
    If vaValues(iPt) <= 1 Then
    .Points(iPt).HasDataLabel = False
    End If
    Next
    End With
    End Sub

    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com/
    _______


    nnj wrote:

    > Hi,
    > I have just started learning Macros &...
    >
    > I need to read thru the values of each data point in a chart and decide
    > if the datalabels need to be displayed on the chart.
    > That is, if the value in a point is less than 1, I do not want the
    > datalabel displayed for that point.
    > Is there a way to access the Value of the points array ?
    > Please help.
    > I duno in which group the Points belong to . This is how I started
    > working on it.
    >
    > Dim p As Points
    > With ActiveChart
    > For Each p In ??
    > If p.Values <= 1 Then
    > p.HasDataLabels = False
    > End If
    > Next p
    > End With
    >
    > Thanx in advance
    >
    >


+ Reply to Thread

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.6.0 RC 1