Show Last Values in  Excel Chart

Posted on 2013-01-14
Last Modified: 2013-01-16
I would like to show the value of only the last point of all series in a line
 chart in excel.

I can do it manually, (click the point in the graph - data labels - show value).
Is it possible to do it automatically, so when I change the data source, the
chart will still show the value of the last point ?  Also,  I am not very familiar with VBA and attached you will find a sample spreadsheet.

I have used this link below but I was unsuccessful to get it working
Question by:jlloyd7940
  • 3
  • 2
LVL 22

Assisted Solution

Flyster earned 150 total points
ID: 38776687
See formulas in Weekly Graphs worksheet cells H9:H10. It's reading the value from your data source and not the chart, but the values are the same.

LVL 18

Expert Comment

by:Curt Lindstrom
ID: 38776950
Try the attached file. It's based on the macros from

You can see the macros in the modules MenuModule, modChartlabels and ThisWorkbook. These macros were copied from in the from web site

I modified the original macro in modChartlabels to this

 Option Explicit

Sub LastPointLabel()
    Dim mySrs As Series
    Dim nPts As Long
    Dim LastLabeled As Boolean
    If ActiveChart Is Nothing Then
        MsgBox "Please select a chart and try again.", vbExclamation
        For Each mySrs In ActiveChart.SeriesCollection
            LastLabeled = False
            nPts = mySrs.Points.Count
            For nPts = mySrs.Points.Count To 1 Step -1
                If Not mySrs.Values(nPts) = Empty Then
                    If LastLabeled = False Then
                        With mySrs
                            mySrs.Points(nPts).ApplyDataLabels _
                                    Type:=xlDataLabelsShowValue, _
                                    AutoText:=True, LegendKey:=False
                        End With
                        LastLabeled = True
                        mySrs.Points(nPts).HasDataLabel = False
                    End If
                End If
    End If
End Sub

Open in new window

Please note that the Quota series in your original file had C3:C15 and C23 which I changed to C3:C15

LVL 18

Accepted Solution

Curt Lindstrom earned 350 total points
ID: 38776965
This version only has one macro which is the same modifed macro but without the modules MenuModule, modChartlabels and ThisWorkbook.

The macro is stored as a worksheet macro and activated when the Weekly Graphs sheet is opened.

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.


Author Comment

ID: 38779951

Thank you very much for all the responses and solutions are fantastic.
LVL 22

Expert Comment

ID: 38781053
Thank you. I realize my solution didn't address specifically what you were looking for (Value from a chart), but it showed that there was a non-VBA approach!
LVL 18

Expert Comment

by:Curt Lindstrom
ID: 38781268
You're welcome! Let me know if you need anything to be clarified.


Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel Cell Total 3 22
Rather Simple Formatting Question 6 24
formatting - number format 2 14
Formula Help 3 23
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question