Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

https://stackoverflow.com/questions/17741871/checking-existence-of-pivot-table-with-its-name-using-formula

Public Function ExistPivot(PTName As String) As Boolean
Dim WS As Worksheet, PT As PivotTable

    ExistPivot = False
    For Each WS In ActiveWorkbook.Worksheets
        For Each PT In WS.PivotTables
            If PT.Name = PTName Then
                ExistPivot = True
                Exit Function
            End If
        Next PT
    Next WS
End Function

Sub Test()
 PTableExists = ExistPivot("TableName")
 MsgBox PTableExists
End Sub

  • No labels