I have a large workbook, with similar pivot tables on every sheet. Some rows of the pivot tables have fill color. I need to loop through the workbook and make these fill colors consistent.
I set about doing this by recording a macro of myself putting in the fill color for one particular type of row, and here's what it produced:
Notice the word "Jones" on the second line of code. Jones is the data selected under "report filter." That can't be in the generic code, because with each worksheet, a different person's name is going to appear there.
Perhaps there is some kind of wildcard variable I can put into the code instead of "Jones"?
I'm also open to different approaches. All these pivot tables pull data from the same source, if that matters.
Thank you!
I set about doing this by recording a macro of myself putting in the fill color for one particular type of row, and here's what it produced:
Code:
PivotFormat()
'
'PivotFormat
'
ActiveSheet.PivotTables("PivotTable12").PivotSelect _
"'Sold To Customer'[All;Total] Jones", xlDataAndLabel, True
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent5
.TintAndShade = 0.599993896298105
.PatternTintAndShade = 0
End With
End Sub
Notice the word "Jones" on the second line of code. Jones is the data selected under "report filter." That can't be in the generic code, because with each worksheet, a different person's name is going to appear there.
Perhaps there is some kind of wildcard variable I can put into the code instead of "Jones"?
I'm also open to different approaches. All these pivot tables pull data from the same source, if that matters.
Thank you!