+ Reply to Thread
Results 1 to 2 of 2

Display the last point's data label in series with VBA

  1. #1
    Registered User
    Join Date
    06-22-2010
    Location
    ontario
    MS-Off Ver
    Excel 2007
    Posts
    16

    Display the last point's data label in series with VBA

    Hello,
    I have one Excel sheet containing multiple charts.
    Each chart have multiple series.
    I want to display the datalabel of the last point only, in all the series of all the charts.
    I want to be able to achieve this by VBA.
    Also, because of the series are made from dynamic range, so the last point in all the series change when a parameter variate.
    How can i do this?
    thanks a lot
    Last edited by cesna123; 09-08-2010 at 11:14 AM.

  2. #2
    Registered User
    Join Date
    06-22-2010
    Location
    ontario
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Display the last point's data label in series with VBA

    ok, i found one procedure, it works

    Sub xd()

    Dim ws As Worksheet
    Set ws = Sheets("charts")


    For i = 1 To ws.ChartObjects.Count


    ws.ChartObjects(i).Activate


    For ii = 1 To ActiveChart.SeriesCollection.Count


    For iii = 1 To ActiveChart.SeriesCollection(ii).Points.Count

    lastPoint = ActiveChart.SeriesCollection(ii).Points.Count
    If ActiveChart.SeriesCollection(ii).DataLabels(iii).ShowValue Then
    ActiveChart.SeriesCollection(ii).DataLabels(iii).ShowValue = False
    End If

    ActiveChart.SeriesCollection(ii).DataLabels(lastPoint).ShowValue = True


    Next iii 'point

    Next ii 'serie



    Next i 'graph

    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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