getting and defining a multiple item filter on a non-OLAP Pivot Table

MNBUARQUE

New Member
Joined
Aug 27, 2014
Messages
3
Hi,
I have a non-OLAP Pivot table and I need to take the multiple items selected into "Report Filter" fields (i am not calling this items as "pages" to avoid OLAP terminology) and bring them to another non-OLAP Pivot table.
When "multiple items" is not enabled it is easy - using the property .pivotfield.currentpage.
But I've tried to do the same using the collection or array from property .pivotfield.currentpagelist with no success.
I think currentpagelist property does not work on non-OLAP Pivot tables.

I've could do what I need building an array with the visible items into the report filter field to be "cloned" and using this array to make the items visible on the other pivot table. The problem is, doing in this way, in the second step, I have to make the items visible one by one (with a loop over the array items) and it takes a lot !(the code I used is copied below)
I am pretty sure I can “implant” the visible items in the second pivot in just on command, but I don´t know how!

Could you help-me ?

-----------------------------------------------------
Sub espelha()

Dim myarray(1 To 20, 0 To 9999) As Variant
Application.ScreenUpdating = False

j = 1
i = 1
x = 1

With ActiveSheet.PivotTables("tabref")
For Each campo In .PageFields
j = 1
For Each iten In campo.PivotItems
If iten.Visible = False Then
mray = iten.Name
myarray(i, j) = mray
j = j + 1
End If
Next iten
myarray(i, 0) = Array(campo.Name, j - 1)
i = i + 1
Next campo

End With

With ActiveSheet.PivotTables("tabslave")
For a = 1 To i - 1
If Not IsError(.PivotFields(myarray(a, 0)(0)).ClearAllFilters) Then
.PivotFields(myarray(a, 0)(0)).ClearAllFilters
For b = 1 To myarray(a, 0)(1)
.PivotFields(myarray(a, 0)(0)).PivotItems(myarray(a, b)) _
.Visible = False
Next b
End If
Next a
End With

End Sub
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,214,983
Messages
6,122,592
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top