Adding Data Label value with VBA to a chart

L

Les

Hi all, i recorded a macro to make a basic bar chart and selected it to show
the data label value, but it does not show it when i run the macro.

Any assistance will be appreciated.
 
J

Joel

when a chart first gets created it is on its own sheet. If you put it on a
worksheet the chart changes names but is still active. See code below.


Set NewChart = Charts.Add

NewChart.ChartType = xlXYScatter
NewChart.SetSourceData _
Source:=Sheets("Sheet1").Range("H12:I13"), _
PlotBy:=xlRows
NewChart.Location _
Where:=xlLocationAsObject, Name:="Sheet1"
Set NewChart = ActiveChart

NewChart.SeriesCollection(1).ApplyDataLabels _
AutoText:=True, _
LegendKey:=False, _
ShowSeriesName:=False, _
ShowCategoryName:=True, _
ShowValue:=True, _
ShowPercentage:=False, _
ShowBubbleSize:=False
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top