Access Beginner
Active Member
- Joined
- Nov 8, 2010
- Messages
- 311
- Office Version
- 2016
- Platform
- Windows
Hi All
I have a few charts in a workbook, which I export to Word. One Manager likes these charts as a line chart and another Manager likes these as column charts.
I've recorded two macros to change to a line chart and change to a column chart.
Regarding the 1st macro (changing to line chart) I was unable to record the alignment of the data labels, can someone please include the code to change the alignment to -27?
Secondly can someone somehow tweak the code, so that I can specify which charts I want to change to a line chart ie Chart 5, Chart 6 etc and also do the same for the change to Colum Chart code?
Code to change to a line chart
Code to change to column chart
Cheers
Haydn
I have a few charts in a workbook, which I export to Word. One Manager likes these charts as a line chart and another Manager likes these as column charts.
I've recorded two macros to change to a line chart and change to a column chart.
Regarding the 1st macro (changing to line chart) I was unable to record the alignment of the data labels, can someone please include the code to change the alignment to -27?
Secondly can someone somehow tweak the code, so that I can specify which charts I want to change to a line chart ie Chart 5, Chart 6 etc and also do the same for the change to Colum Chart code?
Code to change to a line chart
Code:
Sub Change_Chart_Line()
'Change charts specified to line chart
Sheets("Dashboard Trend (2)").Select
ActiveSheet.ChartObjects("Chart 5").Activate
ActiveChart.ChartType = xlLine
ActiveSheet.ChartObjects("Chart 5").Activate
ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.Position = xlLabelPositionAbove
End Sub
Code to change to column chart
Code:
Sub Change_Chart_Column()
'
' Change charts to column chart'
'
Sheets("Dashboard Trend (2)").Select
ActiveSheet.ChartObjects("Chart 5").Activate
ActiveChart.PlotArea.Select
ActiveChart.ChartType = xlColumnClustered
ActiveSheet.ChartObjects("Chart 5").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.Position = xlLabelPositionInsideBase
End Sub
Cheers
Haydn