LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Select PivotTable Page Problem

Hi All,

I am having problems with selecting a page field in a number of pivot
tables using VBA.

I have 10 pivot tables in separate sheets. Each is looking at the same
data, and all have the same layout. Each one has a Page field showing
months and row headings showing dates. They all also have another Page
field which will not change, and the value in each of these is
different for each pivot.

I want the user to be able to select a month from a dropdown or list
box, either in a userform or embedded on a sheet and for this to
change the month in all the pivot tables. The rows will then change to
show only dates from that month. This code works fine until the user
selects a month for which there is no data. My code just adds the
month as a new Page field and leaves the previously selected data
showing. So, for example, if the user selects September, and there is
no September data, you get September as a Page Field and August dates
in the row headings, if August was the previously selected month.

I then thought that if I restricted the dropdown/list box to show only
items in the page field, the user would not be able to select a
non-existent month. I found a bit of code in this group but it loads
not only the months in the Page field but also the dates I have as row
headings.

My code to change the page field is:

'Loop through all sheets with pivottables and do this
Sheets(SheetName).PivotTables(PivotTableName).Pivo tFields("FiscalMonth").CurrentPage
= Me.ComboBox1.Value

My code to add months to the dropdown is: (From Bill Glanville)

Dim PI As PivotItem
Me.ComboBox1.Clear
For Each PI In Sheets("Sheet1").PivotTables("PivotTable1").PageFi elds("FiscalMonth").PivotItems
Me.ComboBox1.AddItem PI.Name
Next

Any help, as always, much appreciated.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PivotTable - how do I hide page field when printing Celia Excel Discussion (Misc queries) 2 October 18th 06 09:46 PM
PivotTable - How to unhide page field items? Epinn New Users to Excel 3 October 16th 06 01:10 PM
Print tab for each page field in PivotTable Scott Hernandez Excel Discussion (Misc queries) 1 August 24th 06 03:38 PM
Multiple page report in a pivottable Rayo K Excel Discussion (Misc queries) 3 April 21st 06 01:02 PM
Select different source data for a PivotTable chetoos Excel Worksheet Functions 1 September 8th 05 07:14 PM


All times are GMT +1. The time now is 01:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"