Public Function SlicerCount( _ scl As SlicerCacheLevel, _ Optional NonBlankOnly As Boolean = True, _ Optional Verbose As Boolean = True _ ) Dim si As SlicerItem Dim iCount As Integer Dim iVerboseCount As Integer Dim iTotal As Integer iCount = 0 If Verbose Then iVerboseCount = 0 iTotal = scl.SlicerItems.Count End If For Each si In scl.SlicerItems If NonBlankOnly Then If SlicerItemIsPopulated(si) Then iCount = iCount + 1 End If Else iCount = iCount + 1 End If If Verbose Then iVerboseCount = iVerboseCount + 1 Application.StatusBar = _ "Counting Slicer Items (" & _ Pct( _ iVerboseCount, _ iTotal _ ) & _ " complete)..." End If Next si SlicerCount = iCount If Verbose Then Application.StatusBar = False End If End Function
Leave a Reply