Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default PivotTable CurrentPage

I am trying to return the displayed page name of a pivottable. The code that
I have been using is as follows:

Function PvtTablePageName(ByVal pvtTable As PivotTable) As String

Dim pgName As String
Dim pt As PivotTable
Set pt = Worksheets("Sheet1").PivotTables(pvtTable)
pgName = pt.PivotFields("Account #").CurrentPage.Name
PvtTablePageName = pgName

End Function

This returns a #VALUE error. Any help would be appreciated.

Regards,
Mark

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default PivotTable CurrentPage

I assume you are passing in the Pivot Table name as a string.

Function PvtTablePageName(ByVal pvtTable As String) As String
'comment out the next line if this is not used in a worksheet cell
Application.Volatile
Dim pgName As String
Dim pt As PivotTable
Set pt = Worksheets("Sheet1").PivotTables(pvtTable)
pgName = pt.PivotFields("Account #").CurrentPage.Name
PvtTablePageName = pgName

End Function


--
Regards,
Tom Ogilvy

"Mark Petruszak" wrote in message
...
I am trying to return the displayed page name of a pivottable. The code

that
I have been using is as follows:

Function PvtTablePageName(ByVal pvtTable As PivotTable) As String

Dim pgName As String
Dim pt As PivotTable
Set pt = Worksheets("Sheet1").PivotTables(pvtTable)
pgName = pt.PivotFields("Account #").CurrentPage.Name
PvtTablePageName = pgName

End Function

This returns a #VALUE error. Any help would be appreciated.

Regards,
Mark



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default PivotTable CurrentPage

Thank you Tom. Your answer helped me.

Regards,
Mark


"Tom Ogilvy" wrote:

I assume you are passing in the Pivot Table name as a string.

Function PvtTablePageName(ByVal pvtTable As String) As String
'comment out the next line if this is not used in a worksheet cell
Application.Volatile
Dim pgName As String
Dim pt As PivotTable
Set pt = Worksheets("Sheet1").PivotTables(pvtTable)
pgName = pt.PivotFields("Account #").CurrentPage.Name
PvtTablePageName = pgName

End Function


--
Regards,
Tom Ogilvy

"Mark Petruszak" wrote in message
...
I am trying to return the displayed page name of a pivottable. The code

that
I have been using is as follows:

Function PvtTablePageName(ByVal pvtTable As PivotTable) As String

Dim pgName As String
Dim pt As PivotTable
Set pt = Worksheets("Sheet1").PivotTables(pvtTable)
pgName = pt.PivotFields("Account #").CurrentPage.Name
PvtTablePageName = pgName

End Function

This returns a #VALUE error. Any help would be appreciated.

Regards,
Mark




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
Creating a PivotTable w/o selecting data in an existing PivotTable Damian Excel Discussion (Misc queries) 6 November 2nd 07 04:44 PM
Finding CurrentPage in PivotTable Grant Excel Programming 1 November 14th 04 10:18 PM
PivotTable - PivotTable Field name is not valid - error! miker1999[_17_] Excel Programming 1 June 10th 04 10:30 AM
weird problem with PivotFields CurrentPage Chrysalis Excel Programming 0 April 22nd 04 01:51 AM
Pivotfields.CurrentPage Daniel Magnus Bennét Björck Excel Programming 5 February 6th 04 02:48 PM


All times are GMT +1. The time now is 03:28 PM.

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"