View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
pgchop pgchop is offline
external usenet poster
 
Posts: 7
Default Pivot table "Group and Show Details" vs. "SubTotals"


In a Pivot table, When the "Group and Show Details" of a group is set to
"Show Details",
i.e. the details are visible, it is fairly easy to find out if the subtotal
has been set to
"none" or "Automatics":

For cdx = 1 To
Application.WorksheetFunction.Min(UBound(ActiveShe et.PivotTables("PivotTable1").RowRange.Cells.Value 2, 2), 4)
If ActiveSheet.PivotTables("PivotTable1").RowRange.Ce lls(cdx) <
"Article-no. + descr." Then
SubtotalName =
ActiveSheet.PivotTables("PivotTable1").RowRange.Ce lls(cdx)
ColNam = "'" & Replace(SubtotalName, "'", "''") & "'[All;Total]"
IsSubtotalVisible =
ActiveSheet.PivotTables("PivotTable1").PivotFields (SubtotalName).Subtotals(1)
If IsSubtotalVisible Then
ActiveSheet.PivotTables("PivotTable1").PivotSelect ColNam,
xlDataAndLabel, True
Selection.Interior.ColorIndex = RowBoundCol(cdx)
Selection.Interior.Pattern = xlSolid
Selection.WrapText = False
End If
End If
Next

But this code fail is the "Group and Show Details" of a group was set to
"Hide Details"
while the subtotal is still on "Automatic". This mean, the subtotal is here,
but not visible.

As you can see, I try here to color automatically the subtotal background.

How can I set IsSubtotalVisible to false if the "Group and Show Details" of
the group was set to "Hide Details" ???

Thanks for your help.