Change Pivot Table PageArea Selection

J

JMay

My Current Pivot table (Named Pivottable1) on my sheet named MyPT has a Page
Area with Values (ALL, 1,2,3,4,5). I need to Change it from another sheet
named Report!Range("b4").value - that would only contain the values, 1 to 5.

When I enter into Cell B4, say 5 -- I need for my Pivottable1 (on MyPT
sheet) to filter the PageArea selection to 5, and REFRESH the PT.

How can I do this?

Thanks in Advance for any assistance...
 
J

JMay

Found this in a VBA book -- I had to modify some... Do you see a problem?
It seems to be working OK, but that only means for now LOL,,,
Thanks,
Jim

Sub UpDatePageArea()
Dim ws As Worksheet
Dim PT As PivotTable
Application.ScreenUpdating = False
Sheets("ViewOnlyReport").Activate
Set ws = Worksheets("ViewOnlyReport")
Set PT = ActiveSheet.PivotTables("Pivottable1")
PT.PivotFields("GroupNo").CurrentPage =
Sheets("GroupReports").Range("B4").Value
PT.PivotCache.Refresh
CopyPTtoGroupReports
Sheets("GroupReports").Activate
Application.ScreenUpdating = True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top