ateneva
3/3/2018 - 12:48 PM

How can I check if I've got different pivot caches in my workbook?

How can I check if I've got different pivot caches in my workbook?

Sub CountWbkCachesAndShowWbkSize()

Dim PC As PivotCache
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If ActiveWorkbook.PivotCaches.Count = 0 Then
    MsgBox "The current workbook has 0 caches"
    
    Else
    
    'counts the number of PivotCaches
    MsgBox "The current workbook has " & ActiveWorkbook.PivotCaches.Count & " caches" _
            & vbNewLine _
 & "The current workbook size is " & Round(FileLen(ActiveWorkbook.FullName) / 1048576, 2) & " MB"
    

End If

End Sub