JohnK
02-06-2006, 01:50 PM
Hello,
Is it possible to select all page fields and then deselect one, rather than just selecting each page field that you want.
Here is the code:
Private Sub selectXFL()
With ActiveSheet.PivotTables("PivotTable1").PivotFields("[State]")
.CubeField.EnableMultiplePageItems = True
.AddPageItem "[State].[All State].[AK]", True
.AddPageItem "[State].[All State].[AL]"
.AddPageItem "[State].[All State].[AR]"
.AddPageItem "[State].[All State].[AZ]"
.AddPageItem "[State].[All State].[CA]"
.AddPageItem "[State].[All State].[CO]"
.AddPageItem "[State].[All State].[CT]"
.AddPageItem "[State].[All State].[DC]"
.AddPageItem "[State].[All State].[DE]"
.AddPageItem "[State].[All State].[GA]"
.AddPageItem "[State].[All State].[HI]"
.AddPageItem "[State].[All State].[IA]"
.AddPageItem "[State].[All State].[ID]"
.AddPageItem "[State].[All State].[IL]"
.AddPageItem "[State].[All State].[IN]"
.AddPageItem "[State].[All State].[KS]"
.AddPageItem "[State].[All State].[KY]"
.AddPageItem "[State].[All State].[LA]"
.AddPageItem "[State].[All State].[MA]"
.AddPageItem "[State].[All State].[MD]"
.AddPageItem "[State].[All State].[ME]"
.AddPageItem "[State].[All State].[MI]"
.AddPageItem "[State].[All State].[MN]"
.AddPageItem "[State].[All State].[MO]"
.AddPageItem "[State].[All State].[MS]"
.AddPageItem "[State].[All State].[MT]"
.AddPageItem "[State].[All State].[NC]"
.AddPageItem "[State].[All State].[ND]"
.AddPageItem "[State].[All State].[NE]"
.AddPageItem "[State].[All State].[NH]"
.AddPageItem "[State].[All State].[NJ]"
.AddPageItem "[State].[All State].[NM]"
.AddPageItem "[State].[All State].[NV]"
.AddPageItem "[State].[All State].[NY]"
.AddPageItem "[State].[All State].[OH]"
.AddPageItem "[State].[All State].[OK]"
.AddPageItem "[State].[All State].[OR]"
.AddPageItem "[State].[All State].[PA]"
.AddPageItem "[State].[All State].[PR]"
.AddPageItem "[State].[All State].[RI]"
.AddPageItem "[State].[All State].[SC]"
.AddPageItem "[State].[All State].[SD]"
.AddPageItem "[State].[All State].[TN]"
.AddPageItem "[State].[All State].[TX]"
.AddPageItem "[State].[All State].[UT]"
.AddPageItem "[State].[All State].[VA]"
.AddPageItem "[State].[All State].[VT]"
.AddPageItem "[State].[All State].[WA]"
.AddPageItem "[State].[All State].[WI]"
.AddPageItem "[State].[All State].[WV]"
.AddPageItem "[State].[All State].[WY]"
End With
End Sub
Thanks,
John
Is it possible to select all page fields and then deselect one, rather than just selecting each page field that you want.
Here is the code:
Private Sub selectXFL()
With ActiveSheet.PivotTables("PivotTable1").PivotFields("[State]")
.CubeField.EnableMultiplePageItems = True
.AddPageItem "[State].[All State].[AK]", True
.AddPageItem "[State].[All State].[AL]"
.AddPageItem "[State].[All State].[AR]"
.AddPageItem "[State].[All State].[AZ]"
.AddPageItem "[State].[All State].[CA]"
.AddPageItem "[State].[All State].[CO]"
.AddPageItem "[State].[All State].[CT]"
.AddPageItem "[State].[All State].[DC]"
.AddPageItem "[State].[All State].[DE]"
.AddPageItem "[State].[All State].[GA]"
.AddPageItem "[State].[All State].[HI]"
.AddPageItem "[State].[All State].[IA]"
.AddPageItem "[State].[All State].[ID]"
.AddPageItem "[State].[All State].[IL]"
.AddPageItem "[State].[All State].[IN]"
.AddPageItem "[State].[All State].[KS]"
.AddPageItem "[State].[All State].[KY]"
.AddPageItem "[State].[All State].[LA]"
.AddPageItem "[State].[All State].[MA]"
.AddPageItem "[State].[All State].[MD]"
.AddPageItem "[State].[All State].[ME]"
.AddPageItem "[State].[All State].[MI]"
.AddPageItem "[State].[All State].[MN]"
.AddPageItem "[State].[All State].[MO]"
.AddPageItem "[State].[All State].[MS]"
.AddPageItem "[State].[All State].[MT]"
.AddPageItem "[State].[All State].[NC]"
.AddPageItem "[State].[All State].[ND]"
.AddPageItem "[State].[All State].[NE]"
.AddPageItem "[State].[All State].[NH]"
.AddPageItem "[State].[All State].[NJ]"
.AddPageItem "[State].[All State].[NM]"
.AddPageItem "[State].[All State].[NV]"
.AddPageItem "[State].[All State].[NY]"
.AddPageItem "[State].[All State].[OH]"
.AddPageItem "[State].[All State].[OK]"
.AddPageItem "[State].[All State].[OR]"
.AddPageItem "[State].[All State].[PA]"
.AddPageItem "[State].[All State].[PR]"
.AddPageItem "[State].[All State].[RI]"
.AddPageItem "[State].[All State].[SC]"
.AddPageItem "[State].[All State].[SD]"
.AddPageItem "[State].[All State].[TN]"
.AddPageItem "[State].[All State].[TX]"
.AddPageItem "[State].[All State].[UT]"
.AddPageItem "[State].[All State].[VA]"
.AddPageItem "[State].[All State].[VT]"
.AddPageItem "[State].[All State].[WA]"
.AddPageItem "[State].[All State].[WI]"
.AddPageItem "[State].[All State].[WV]"
.AddPageItem "[State].[All State].[WY]"
End With
End Sub
Thanks,
John