View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] Flooder4@gmail.com is offline
external usenet poster
 
Posts: 4
Default Set selection of Pivot Table using VBA

Hi all,

I have to manipulate the selection of fields in a Pivot Table using
VBA.
Description:
One Worksheet hosts a Pivot Table which hosts a lot of Data. Another
Worksheet, which is used for an Executive Summary only displays one
line of the original table.
To allow the user switching between different Quarters in this
executive summary I have to change the selected data in the original
Pivot Table.
I created a drop down field where Quarters (Q1, Q2, Q3, Q4) can be
selected and would like that a change here would affect the original
Pivot Table (change the Page Field Data).
Therefore I programmed a small macro which doesn't work in the way I
expect it. After all it does nothing.
Can anybody help me as I am a bloody starter in programming VBA?

Public Sub ChangePage()
Sheets("OverallView").Select
Set
ActiveSheet.PivotTables("PivotTable3").PivotFields ("Quarter").CurrentPage
= Range("ExecutiveS!G5").Value
Sheets("ExecutiveS").Select
End Sub