我有一个数据透视图,我正在尝试使用模式格式化图表中的某些数据系列。我录制了一个宏来看看 Excel 是如何做到的。这给了我:
With Selection.Format.Fill
.Visible = msoTrue
.Patterned msopatternDarkUpwardDiagonal
End With
我已经适应了:
With chrt1Overview 'chart object codename
(....)
With .FullSeriesCollection(i) 'iterating through series
.ChartType = xlColumnStacked
If .Name Like "FORECAST" Then
With .Format.Fill
.Visible = msoTrue
.Patterned msoPatternDarkUpwardDiagonal
End With
End If
End with
End with
这给了我下面的错误,msoTrue
并msoPatternDarkupwardDiagonal
在我的代码中突出显示
编译错误:
变量未定义
运行由记录器创建的宏也不起作用,mso
“变量”为空,并给出指定值超出范围的错误,但不会给我一个编译错误,因为Option Explicit
未在此模块上设置。
在数据系列上设置模式填充的正确方法是什么?