Vba 格式化数据透视图系列

Vba 格式化数据透视图系列,vba,excel,enumeration,pivot-chart,Vba,Excel,Enumeration,Pivot Chart,我有一个透视图,我正试图用一种模式格式化我的图表中的某些数据系列。我录制了一个宏,看看Excel是如何做到这一点的。这给了我: With Selection.Format.Fill .Visible = msoTrue .Patterned msopatternDarkUpwardDiagonal End With 我已经适应了: With chrt1Overview 'chart object codename (....) With .FullSeriesC

我有一个透视图,我正试图用一种模式格式化我的图表中的某些数据系列。我录制了一个宏,看看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
“变量”为空,并给出指定值超出范围的错误,但不会给出编译错误,因为此模块上未设置
选项Explicit


在数据系列上设置填充模式的正确方法是什么?

Google
Enum msoTrue
Enum msoPatternDarkUpwardDiagonal
找出值,然后使用值替换。这就是你写累了的结果;我一生都搞不清楚这件事。谢谢@braX