2

I have a pivot chart and I'm trying to format certain dataseries in my chart with a pattern. I recorded a macro to see how Excel would do that. This gave me:

With Selection.Format.Fill
    .Visible = msoTrue
    .Patterned msopatternDarkUpwardDiagonal
End With

Which I've adapted to:

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

This gives me the error below and highlights both msoTrue and msoPatternDarkupwardDiagonal in my code

Compile error:

Variable not defined

Running the macro as created by the recorder does not work either, the mso "variables" are empty and gives an error that the specified value is out of range but does not give me a compile error because the Option Explicit is not set on this module.

What is the correct way to set a pattern fill on a data series?

braX
  • 11,506
  • 5
  • 20
  • 33
SilentRevolution
  • 1,495
  • 1
  • 16
  • 31
  • Google `Enum msoTrue` and `Enum msoPatternDarkUpwardDiagonal` to find out the values, then just replace using the values. – braX Jan 24 '18 at 14:20
  • 1
    That's what you get for writing tired; I could not, for the life of me, figure this out. Thanks @braX – SilentRevolution Jan 24 '18 at 14:29

0 Answers0