Skip to content

Instantly share code, notes, and snippets.

@andli
Created May 10, 2019 13:27
Show Gist options
  • Save andli/782a9ed47d29defa7061837bc0e19a7c to your computer and use it in GitHub Desktop.
Save andli/782a9ed47d29defa7061837bc0e19a7c to your computer and use it in GitHub Desktop.
Edit all data labels in an Excel graph to show series name
Sub datalabels()
For Each myChart In ActiveSheet.ChartObjects
For Each mySrs In myChart.chart.SeriesCollection
With mySrs
If Not .HasDataLabels Then
.ApplyDataLabels
End If
.datalabels.ShowSeriesName = True
.datalabels.ShowValue = False
End With
Next mySrs
Next myChart
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment