Name

pivotfield.AutoShowCount

Synopsis

Sets or returns the Count argument setting from the AutoShow method. Since all the AutoShow arguments are required, you must use the Auto xxx properties to remove filtering from a pivot field, as shown here:

Sub ResetAutoShowAutoSort(  )
    Dim pt As PivotTable, pf As PivotField
    ' Get pivot table.
    Set pt = Worksheets("BookSales").PivotTables(1)
    ' Get pivot fields
    For Each pf In pt.PivotFields
        pf.AutoShow xlManual, pf.AutoShowRange, _
          pf.AutoShowCount, pf.AutoShowField
        pf.AutoSort xlManual, pf.AutoSortField
    Next
End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.