I am still quite new to vba and have enjoyed it a lot, however I have been having a problem with formatting pivot tables.
I want to highlight cells above or below a certain value and have come up with the following code by recording.
Sheets("41 & 41a").Select
Range("B17").Select
ActiveWorkbook.RefreshAll
ActiveSheet.PivotTables("PivotTable1").PivotFields("Transaction ID"). _
ShowDetail = True
ActiveSheet.PivotTables("PivotTable1").PivotSelect _
"'Transaction ID'[All;Total] 'Row Grand Total'", xlDataAndLabel, True
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlNotBetween, _
Formula1:="=Instructions!$E$8", Formula2:="=Instructions!$F$8"
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent6
.TintAndShade = 0.399945066682943
End With
And this is used this code for multiple work sheets. The conditional formatting rule works nearly perfectly however it does not show the highlighted cells when the pivot table is collapsed.
This problem does not occur when formats the pivot tables without a macro.