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

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?

Sub CountWbkCachesAndShowWbkSize()
Dim PC As PivotCache
If ActiveWorkbook.PivotCaches.Count = 0 Then
MsgBox "The current workbook has 0 caches"
'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!