Label at the end of Stacked Bar Pivot Chart

PopSix

New Member
Joined
Aug 31, 2010
Messages
8
I have a stacked bar pivot chart. I would like to add a label or textbox at the end of each of the bar. How do I find and reference the x-y coordinates for the end each bar?

My VBA is limited, but growing. Any snippet or code example would be great.

Thanks.
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,793
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
I take it data labels are no good to you for some reason?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,793
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
Sorry, it appears the reply I thought I posted yesterday never got through.
If you use the data labels, you can alter the text in them - for example:
Code:
    Dim ser As Series
    Dim n As Long
    Dim lbl As DataLabel
    Set ser = ActiveChart.SeriesCollection(9)
    ' note: need to supply one of the text options here
    ser.ApplyDataLabels AutoText:=True, LegendKey:= _
        False, ShowSeriesName:=True, ShowCategoryName:=False, ShowValue:=False, _
        ShowPercentage:=False, ShowBubbleSize:=False
    For n = 1 To ser.Points.Count
        Set lbl = ser.Points(n).DataLabel
        lbl.Characters().Text = "Testing " & n
    Next n
 

PopSix

New Member
Joined
Aug 31, 2010
Messages
8
Great. I'll give it a try.

But from your description it looks like you are changing the label in the series. I want to add label to the end or just below the stack based on the length of the stack.

|--------- Total 1
|
|-----------------Total 2
|
|--Total 3
|
_______________________________________________

Something like that.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,793
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
You can add the datalabels to the last series if you only want them at the end of the stack - or do you already make use of the datalabels in the chart?
 

PopSix

New Member
Joined
Aug 31, 2010
Messages
8
I want to add labels to the end of the stack. How do you reference the end? How would the data label get there?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,793
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
Add them to the last series in the data - then they will be at the end of the stack automatically.
 

PopSix

New Member
Joined
Aug 31, 2010
Messages
8
Thank you for hanging in there with me. But, sorry how do you add them to the last series?
 

Watch MrExcel Video

Forum statistics

Threads
1,095,225
Messages
5,443,197
Members
405,219
Latest member
CraneS

This Week's Hot Topics

  • Copy entire row if CountA <>0 to another sheet
    [B]I want to copy entire row if CountA <>0 for column J7:AM7 (headers on J6:AM6) and so on till the last used cell is column D and paste the...
  • Select last used Row in Table
    I have created a Table in a Worksheet which is locked to prevent user errors and protect formula. Some of the cells require freetext entries which...
  • excel workbook: do not allow certain file name
    Hello all, Don't think this has ever been asked before, but how do I restrict file save [Before_Save Event] if the name of the file being saved...
  • fixing problem autofilter
    hello i need help about my code when i search by code in textbox it doesn't show anything this is my data [ATTACH type="full"...
  • “Weight”
    Hi, i’ve got a long sheet filled with weights such as kg,g,L & ml. i can build a formula to convert kg into g and liter into ml. How ever, my...
  • How to capitalize everything before a certain character?
    In column A, I have some text: Hello good day.mp3 Hello good day.flac etc. I'd like to capitalize everything before the period. I don't need the...
Top