I have the following code, to loop through all the charts in a worksheet and all the series in each chart and change for example the number format and the separator. However i am getting an error: on the line "For Each mychart In mysheet.ChartObjects". Could you please help me.
VBA Code:
Sub LoopThroughCharts()
Dim mysheet As Worksheet
Dim CurrentSheet As Worksheet
Dim mychart As ChartObject
Dim myseries As Series
Application.ScreenUpdating = False
Application.EnableEvents = False
Set CurrentSheet = ActiveSheet
For Each mychart In mysheet.ChartObjects
mychart.Activate
For Each myseries In myChartObject.Chart.SeriesCollection
Selection.NumberFormat = "#'##0"
Selection.Separator = "; "
Next
Next
CurrentSheet.Activate
Application.EnableEvents = True
End Sub
Last edited: