Hello I am trying to create a macro that will automatically update the font of the data labels on my various pivot charts on the sheet of my workbook titled Dashboard. I need to be able to have the chart data labels set to font Arial size 12 and then have the legend formatted so that the font is Arial size 10.5. I keep receiving an error stating error 91
(Object variable or With block variable not set). Error 91
This is the code that I came up with.
Sub DASHfontsize()
' DASHfontsize Macro
' change the font on labels to arial 12 and the legend to arial 10.5
ActiveChart.ChartArea.Select
With Selection.Format.TextFrame2.TextRange.Font
.NameComplexScript = "Arial"
.NameFarEast = "Arial"
.Name = "Arial"
End With
Selection.Format.TextFrame2.TextRange.Font.Size = 12
ActiveChart.Legend.Select
With Selection.Format.TextFrame2.TextRange.Font
.NameComplexScript = "Arial"
.NameFarEast = "Arial"
.Name = "Arial"
End With
Selection.Format.TextFrame2.TextRange.Font.Size = 10.5
End Sub
Any help in correcting would be greatly appreciated.
Thank you in advance.