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