Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Pivot Table - Page List

I recorded a macro to find out the syntax for choosing
which page in a pivot table I wish to look at:

ActiveSheet.PivotTables("PivotTable6").PivotFields
("Name").CurrentPage = "MIKE"

Now I would like to obtain a listing of all the pages in
that pivot table. Does anyone know how to get that list
of values? I will be using that list to create a separate
dropdown control. Selecting values from the dropdown
control will feed a macro which will set the pivot table
to the desired page, etc., etc.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Pivot Table - Page List

Mike,

You can apply a filter to the source data to extract unique elements from
the field that you are using as your page. Here's an example for column H of
the activesheet:

Option Explicit
Option Base 0
Sub ExtractUniqueValues()
Dim myCell As Range
Dim myVals() As Variant
Dim UniqueCount As Integer
Dim i As Integer

UniqueCount = 0

With Range("H1:H" & Range("H65536").End(xlUp).Row)
.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
For Each myCell In Intersect(Range("2:65536"), _
.SpecialCells(xlCellTypeVisible))
ReDim Preserve myVals(UniqueCount)
myVals(UniqueCount) = myCell.Value
UniqueCount = UniqueCount + 1
Next myCell
ActiveSheet.ShowAllData
End With
For i = LBound(myVals) To UBound(myVals)
MsgBox myVals(i)
Next i
End Sub

HTH,
Bernie
MS Excel MVP

"Mike Swintosky" wrote in message
...
I recorded a macro to find out the syntax for choosing
which page in a pivot table I wish to look at:

ActiveSheet.PivotTables("PivotTable6").PivotFields
("Name").CurrentPage = "MIKE"

Now I would like to obtain a listing of all the pages in
that pivot table. Does anyone know how to get that list
of values? I will be using that list to create a separate
dropdown control. Selecting values from the dropdown
control will feed a macro which will set the pivot table
to the desired page, etc., etc.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Pivot Table - Page List

Thanks Bernie. I'll add that to my toolbox!

Mike
-----Original Message-----
Mike,

You can apply a filter to the source data to extract

unique elements from
the field that you are using as your page. Here's an

example for column H of
the activesheet:

Option Explicit
Option Base 0
Sub ExtractUniqueValues()
Dim myCell As Range
Dim myVals() As Variant
Dim UniqueCount As Integer
Dim i As Integer

UniqueCount = 0

With Range("H1:H" & Range("H65536").End(xlUp).Row)
.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
For Each myCell In Intersect(Range("2:65536"), _
.SpecialCells(xlCellTypeVisible))
ReDim Preserve myVals(UniqueCount)
myVals(UniqueCount) = myCell.Value
UniqueCount = UniqueCount + 1
Next myCell
ActiveSheet.ShowAllData
End With
For i = LBound(myVals) To UBound(myVals)
MsgBox myVals(i)
Next i
End Sub

HTH,
Bernie
MS Excel MVP

"Mike Swintosky"

wrote in message
...
I recorded a macro to find out the syntax for choosing
which page in a pivot table I wish to look at:

ActiveSheet.PivotTables("PivotTable6").PivotFields
("Name").CurrentPage = "MIKE"

Now I would like to obtain a listing of all the pages in
that pivot table. Does anyone know how to get that list
of values? I will be using that list to create a

separate
dropdown control. Selecting values from the dropdown
control will feed a macro which will set the pivot table
to the desired page, etc., etc.



.

Reply
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
Pivot Table Page Breaks cware Excel Discussion (Misc queries) 0 February 17th 09 07:49 PM
Pivot Table Page PFLY Excel Discussion (Misc queries) 2 June 20th 08 01:49 PM
How do I sort a pivot table page list? stevekop Excel Discussion (Misc queries) 1 November 1st 07 02:37 AM
Page field - pivot table yshridhar Excel Discussion (Misc queries) 0 August 1st 07 04:48 AM
Pivot Table dropping items from page item list Sharon Excel Discussion (Misc queries) 4 April 4th 06 08:35 AM


All times are GMT +1. The time now is 11:07 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"