MarkCBB
Active Member
- Joined
- Apr 12, 2010
- Messages
- 497
Hi there VBA pros,
I am trying to fix and workbook so that all of the pivot table are filtered correctly by region.
there are between 3 10 pivot tables on each sheet,however I dont want to loop though all sheets, just all PT in activesheet.
however not all the Pivot tables have filters (for the ones without filters nothing should happen) but if the pivot table has a filter it needs to only select the region according to the activeworksheet.name. all the others should be deselected.
I have attempted this, but I am not very good with code for PT.
as you can see this is not gonna work.
any assistance would be greatly appreciated.
I am trying to fix and workbook so that all of the pivot table are filtered correctly by region.
there are between 3 10 pivot tables on each sheet,however I dont want to loop though all sheets, just all PT in activesheet.
however not all the Pivot tables have filters (for the ones without filters nothing should happen) but if the pivot table has a filter it needs to only select the region according to the activeworksheet.name. all the others should be deselected.
I have attempted this, but I am not very good with code for PT.
Code:
Sub a_pt()
For Each PivotTable In activeworksheet
If pt.Pi <> activeworksheet.Name Then
pt.Pi.Visible = False
End If
Next pt.Pi
End Sub
as you can see this is not gonna work.
any assistance would be greatly appreciated.