Name

pivotcache.MemoryUsed

Synopsis

Returns the amount of memory used by the pivot cache in bytes. The following code displays the total memory used by pivot caches in the Immediate window:

Sub CountCache(  )
    Dim pc As PivotCache, mem As Long
    For Each pc In ActiveWorkbook.PivotCaches
        mem = mem + pc.MemoryUsed
    Next
    Debug.Print "#PivotCaches", "Mem Used"
    Debug.Print ActiveWorkbook.PivotCaches.Count, mem \ 1024 & "K"
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.