Item Property (CubeFields Collection) Example

Item Property (CubeFields Collection) Example

This example finds the first PivotTable report whose first cube field name contains the string “Paris”. The Boolean variable blnFoundName is set to True if the name is found.

blnFoundName = False
For Each objPT in ActiveSheet.PivotTables
    Set objCubeField = _
        objPT.CubeFields.Item(1)
    If instr(1,objCubeField.Name, "Paris") <> 0 Then
        blnFoundName = True
        Exit For
    End If
Next objPT