Hi,
In a pivot table I want to find the number of selected values (i.e. not the actual values themselves) in the Page, Row labels and Column labels filters, respectively.
I started out with the row and column filters and those elements of the code still work as expected. Unaware of the lurking disappointment I then copied the code to the page filter ...
No matter what selections I make in the page filter the code returns '0'. When I record the sequence where I set the page filter, the code contains bits like ".CurrentPage" and "=Array()", but I cannot get my head around it.
Could anyone give me a push in the right direction?
Thanks,
Henrik
In a pivot table I want to find the number of selected values (i.e. not the actual values themselves) in the Page, Row labels and Column labels filters, respectively.
I started out with the row and column filters and those elements of the code still work as expected. Unaware of the lurking disappointment I then copied the code to the page filter ...
No matter what selections I make in the page filter the code returns '0'. When I record the sequence where I set the page filter, the code contains bits like ".CurrentPage" and "=Array()", but I cannot get my head around it.
Could anyone give me a push in the right direction?
Thanks,
Henrik
Code:
' Count the number of individual values selected in the "Page"-filter (Opportunity Classification)
CtOfValsPge = shtPivot1.PivotTables("PivotTable1").PivotFields("[Table1].[Opportunity Classification].[Opportunity Classification]").VisibleItems.Count ' Always returns '0' ?
' Count the number of individual values selected in the "Row Labels"-filter (Process Stage Name)
CtOfValsRow = shtPivot1.PivotTables("PivotTable1").PivotFields("[Table1].[Process Stage Name (Process Stage) (Process Stage)].[Process Stage Name (Process Stage) (Process Stage)]") _
.VisibleItems.Count
' Count the number of individual values selected in the "Column Labels"-filter (Expected Sales Date (Year))
CtOfValsCol = shtPivot1.PivotTables("PivotTable1").PivotFields("[Table1].[Expected Sales Date (Year)].[Expected Sales Date (Year)]").VisibleItems.Count