ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot table "Group and Show Details" vs. "SubTotals" (https://www.excelbanter.com/excel-programming/352025-pivot-table-group-show-details-vs-subtotals.html)

pgchop

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.


All times are GMT +1. The time now is 06:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com