View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JMay JMay is offline
external usenet poster
 
Posts: 468
Default Change Pivot Table PageArea Selection

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

"ryguy7272" wrote:

Take a look at this:
http://www.contextures.com/xlPivot04.html

Look here too:
http://www.contextures.com/xlPivot01.html

Notice the dozen or so examples at the bottom of the page; that may help you
too.


Regards,
Ryan---
--
RyGuy


"JMay" wrote:

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...