ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding Data Label value with VBA to a chart (https://www.excelbanter.com/excel-programming/411320-adding-data-label-value-vba-chart.html)

Les

Adding Data Label value with VBA to a chart
 
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.

--
Les

joel

Adding Data Label value with VBA to a chart
 
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 _
Whe=xlLocationAsObject, Name:="Sheet1"
Set NewChart = ActiveChart

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

"Les" wrote:

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.

--
Les



All times are GMT +1. The time now is 10:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com