Okay, I know that I should generally avoid having multiple caches in a workbook…
But I’ve got some Excel reports I inherited from a colleague…
How can I check if they’re duplicating caches?
The easiest way would be to check the source data of each pivot table. This, however, may not be the quickest option, especially if you have a workbook with multiple tabs
What do I do then?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Happy Pivotting!