Hello everyone 
I have a problem concerning conditional formatting and pivot tables.
After executing the following macro:
Sub ConditionalFormat()
Range("A1:" & ExcelColNonRec(ActiveSheet.Columns.Count) & CStr(ActiveSheet.Rows.Count)).FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
Formula1:="=0"
With Selection.FormatConditions(1)
.Font.Color = -16383844
.Font.TintAndShade = 0
.Interior.PatternColorIndex = xlAutomatic
.Interior.Color = 13551615
.Interior.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
End Sub
Function ExcelColNonRec(ByVal intCol As Long) As String
While (intCol > 0)
intCol = intCol - 1
ExcelColNonRec = Chr(65 + (intCol Mod 26)) + ExcelColNonRec
intCol = intCol \ 26
Wend
End Function
on a sheet which contains a pivot table, it happens exactly what I want which is negatives get shaded. But if after that you expand any of the categorys within the pivot table, the selection to which the conditional format is applied changes and it no longer works, even when the categorys are closed again.
Can any of you think of a solution to this, so that the conditional format will be applied to all the cells of the pivot table, even when you expand or close each category?
Thanks in advance
Bookmarks