I'm trying to apply a formatting condition to a pivot field, the script below does that but applies Formatting to "Selected Cells" of the Pivot Filed and makes it a static cells range, instead of Pivot Field Values of the pivot table, where as the same can be done manually.
</code>
Rich (BB code):
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">ActiveSheet.PivotTables(PivotName).PivotFields("SPEC").DataRange.FormatConditions.Add Type:=xlNoBlanksCondition
With ActiveSheet.PivotTables(PivotName).PivotFields("CPR SPEC").DataRange.FormatConditions(1)
With.Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.Color = vbBlack
EndWith
With.Borders(xlLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.Color = vbBlack
EndWith
With.Borders(xlRight)
.LineStyle = xlContinuous
.Weight = xlThin
.Color = vbBlack
EndWith
With.Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.Color = vbBlack
EndWith
Endwith