View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.charting
Jon Peltier[_2_] Jon Peltier[_2_] is offline
external usenet poster
 
Posts: 461
Default Macro code to put series name next to individual line in line

The original code created a static label populated by the text that was
the series name when the label was created. Change the series name, the
label does not change.

Modify the ApplyDataLabels command to this:

mySrs.Points(iPts).ApplyDataLabels _
ShowSeriesName:=True, ShowCategoryName:=False, _
ShowValue:=False, AutoText:=False, LegendKey:=False

The label now explicitly shows the series name. Change the series name,
and the label itself changes.

I updated the tutorial when Excel 2007 misbehaved. The new version works
in all versions, and includes the above enhancement:

Label Last Point for Excel 2007 » Peltier Tech Blog
http://peltiertech.com/WordPress/lab...or-excel-2007/

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
774-275-0064
http://peltiertech.com/


On 2/23/2010 6:50 AM, Otani wrote:
I have used the VBA code from the John Peltier link at the bottom. The macro
works but for some reason everytime I change the series name in the table,
the legend in the graph would automatically change as well but the label next
to the graph doesn't. I have to run the macro again to see the change takes
effect. My macro setting is already set to enable all so I don't if I have
missed something.

"Misange" wrote:

Look at this page
http://www.andypope.info/charts/Labellast.htm
Misange

Otani a écrit :
I want to put the series names next to their corresponding line in the line
graph. I remember seeing on the internet that there is a macro code for this
but I cannot find this anymore. Does anyone know what the macro code is?

.