Show Data labels with series name instead of value

BMAK

New Member
Joined
Nov 26, 2008
Messages
8
Hi I was wondering if anyone can help me out? I am trying to get a stacked bar chart to show the series name for each series as a data label. I have the code below, hwoever it generates all of the data labels as series names but groups them all together at the right hand side of the chart. I want to show the data label (shwoing the series name) on each element of the chart.

Cheers for any help in advance!

Code:
   Option Explicit
    Sub LastPointLabel()
      Dim mySrs As Series
      Dim nPts As Long
      For Each mySrs In ActiveChart.SeriesCollection
      With mySrs
        nPts = .Points.Count
        mySrs.ApplyDataLabels _
            Type:=xlDataLabelsShowValue, _
            AutoText:=True, LegendKey:=False
        mySrs.Points(nPts).DataLabel.Text = mySrs.Name
      End With
      Next
    End Sub




 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,203,677
Messages
6,056,688
Members
444,883
Latest member
garyarubin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top