我正在尝试更新名为 Dashboard 的工作簿工作表上各种数据透视图上数据标签的字体。
我需要将图表数据标签设置为 Arial 大小 12,图例字体设置为 Arial 大小 10.5。
我收到
运行时错误“91”:
对象变量或未设置块变量
这是我想出的代码。
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