Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pivot Table Page Breaks | Excel Discussion (Misc queries) | |||
Pivot Table Page | Excel Discussion (Misc queries) | |||
How do I sort a pivot table page list? | Excel Discussion (Misc queries) | |||
Page field - pivot table | Excel Discussion (Misc queries) | |||
Pivot Table dropping items from page item list | Excel Discussion (Misc queries) |