Roboquist
08-16-2017, 09:56 PM
I've recently been working on a piece of code that will change the appearence of all Charts in a sheet to look the same.
So far I've been able to fix the size aswell as some other attributes but I can't get my head around changing the appearence for all series within each chart.
My code so far looks like this:
Sub ResizeCharts()
'Standard
Dim cht As ChartObject
For Each cht In ActiveSheet.ChartObjects
'Chart Size
cht.Height = 750
cht.Width = 452
'Plot Area Size
cht.Chart.PlotArea.Width = 380
cht.Chart.PlotArea.Height = 680
cht.Chart.PlotArea.Left = 40
cht.Chart.PlotArea.Top = 40
'Position Titel X-axis
cht.Chart.Axes(xlCategory).AxisTitle.Left = cht.Chart.Axes(xlCategory).Left + (cht.Chart.Axes(xlCategory).Width - cht.Chart.Axes(xlCategory).AxisTitle.Width) / 2
cht.Chart.Axes(xlCategory).AxisTitle.Top = (cht.Chart.PlotArea.Top - cht.Chart.Axes(xlCategory).Height) / 2
''Position Titel Y-axis
cht.Chart.Axes(xlValue).AxisTitle.Top = cht.Chart.Axes(xlValue).Top + (cht.Chart.Axes(xlValue).Height - cht.Chart.Axes(xlValue).AxisTitle.Height) / 2
cht.Chart.Axes(xlValue).AxisTitle.Left = (cht.Chart.PlotArea.Left - cht.Chart.Axes(xlValue).Width) / 2
'Legend Settings
cht.Chart.Legend.Font.Size = 10
Next
End Sub
For example i want to change the marker size to 7 in all series of all charts. Does anyone have a solution for this?
Greatly thankful
So far I've been able to fix the size aswell as some other attributes but I can't get my head around changing the appearence for all series within each chart.
My code so far looks like this:
Sub ResizeCharts()
'Standard
Dim cht As ChartObject
For Each cht In ActiveSheet.ChartObjects
'Chart Size
cht.Height = 750
cht.Width = 452
'Plot Area Size
cht.Chart.PlotArea.Width = 380
cht.Chart.PlotArea.Height = 680
cht.Chart.PlotArea.Left = 40
cht.Chart.PlotArea.Top = 40
'Position Titel X-axis
cht.Chart.Axes(xlCategory).AxisTitle.Left = cht.Chart.Axes(xlCategory).Left + (cht.Chart.Axes(xlCategory).Width - cht.Chart.Axes(xlCategory).AxisTitle.Width) / 2
cht.Chart.Axes(xlCategory).AxisTitle.Top = (cht.Chart.PlotArea.Top - cht.Chart.Axes(xlCategory).Height) / 2
''Position Titel Y-axis
cht.Chart.Axes(xlValue).AxisTitle.Top = cht.Chart.Axes(xlValue).Top + (cht.Chart.Axes(xlValue).Height - cht.Chart.Axes(xlValue).AxisTitle.Height) / 2
cht.Chart.Axes(xlValue).AxisTitle.Left = (cht.Chart.PlotArea.Left - cht.Chart.Axes(xlValue).Width) / 2
'Legend Settings
cht.Chart.Legend.Font.Size = 10
Next
End Sub
For example i want to change the marker size to 7 in all series of all charts. Does anyone have a solution for this?
Greatly thankful