ExcelNoob222
Board Regular
- Joined
- Jun 17, 2020
- Messages
- 77
- Office Version
- 365
- Platform
- Windows
Hi all,
The below macro applies to my pivot table but as soon as someone filters on the pivot table the conditional disappears from the values section.
Any ideas?
The below macro applies to my pivot table but as soon as someone filters on the pivot table the conditional disappears from the values section.
VBA Code:
' Adds conditional formatting
Dim MyRange As Range
Set MyRange = Range("A10:R5000")
'Adds rules
MyRange.FormatConditions.Add Type:=xlExpression, Formula1:="=SEARCH(""Total"",$E10)"
MyRange.FormatConditions(1).Interior.Color = RGB(250, 208, 184)
MyRange.FormatConditions(1).Font.Bold = True
MyRange.FormatConditions.Add Type:=xlExpression, Formula1:="=SEARCH(""Total"",$C10)"
MyRange.FormatConditions(2).Interior.Color = RGB(255, 242, 204)
MyRange.FormatConditions(2).Font.Bold = True
MyRange.FormatConditions.Add Type:=xlExpression, Formula1:="=SEARCH(""Total"",$B10)"
MyRange.FormatConditions(3).Interior.Color = RGB(226, 239, 218)
MyRange.FormatConditions(3).Font.Bold = True
Any ideas?