Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

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