N
navin
Hi,
i have some 20 charts in a sheet along with the data. I want to change
the fonts of all the charts i.e. title, axis etc. i was able to do
this but some of my charts also have secondary axis and font for the
secondary is not changing.
How to achieve this. I used below code to achieve. Please tell where i
am wrong.
Sub Test()
Dim sht As Worksheet
Dim chtObject As ChartObject
Dim cht As Chart
For Each sht In Worksheets
For Each chtObject In sht.ChartObjects
Set cht = chtObject.Chart
''With cht.Axes(xlCategory)
' .TickLabels.Font.Size = 8
' .AxisTitle.Font.Size = 8
' End With
'On Error Resume Next
For Each a In cht.Axes
With cht.Axes(xlValue)
.TickLabels.Font.Size = 8
.AxisTitle.Font.Size = 8
End With
Next a
With cht.DataTable
.Font.Size = 8
End With
With cht.ChartTitle
.Font.Size = 8
End With
Next chtObject
End Sub
Thanks for the help in advance.
Navin
i have some 20 charts in a sheet along with the data. I want to change
the fonts of all the charts i.e. title, axis etc. i was able to do
this but some of my charts also have secondary axis and font for the
secondary is not changing.
How to achieve this. I used below code to achieve. Please tell where i
am wrong.
Sub Test()
Dim sht As Worksheet
Dim chtObject As ChartObject
Dim cht As Chart
For Each sht In Worksheets
For Each chtObject In sht.ChartObjects
Set cht = chtObject.Chart
''With cht.Axes(xlCategory)
' .TickLabels.Font.Size = 8
' .AxisTitle.Font.Size = 8
' End With
'On Error Resume Next
For Each a In cht.Axes
With cht.Axes(xlValue)
.TickLabels.Font.Size = 8
.AxisTitle.Font.Size = 8
End With
Next a
With cht.DataTable
.Font.Size = 8
End With
With cht.ChartTitle
.Font.Size = 8
End With
Next chtObject
End Sub
Thanks for the help in advance.
Navin