PC Review


Reply
Thread Tools Rate Thread

determine the name of the selected pivot table

 
 
Tim879
Guest
Posts: n/a
 
      23rd Sep 2007
does anyone know how to determine the name of the pivot table the user
has selected.

I have code I want to run against the selected pivot table however the
name of the pivot table is not constant nor is it always the first
pivot table on a given sheet.

Thanks
Tim

 
Reply With Quote
 
 
 
 
Debra Dalgleish
Guest
Posts: n/a
 
      23rd Sep 2007
As answered in .programming:

You can test if the active cell is in a pivot table, and if it is, get
the pivot table name:

Sub test()
Dim pt As PivotTable

On Error Resume Next
Set pt = ActiveCell.PivotTable

If pt Is Nothing Then
Debug.Print "Active cell is not in a pivot table"
Else
Debug.Print ActiveCell.PivotTable.Name
End If

Set pt = Nothing
End Sub

Tim879 wrote:
> does anyone know how to determine the name of the pivot table the user
> has selected.
>
> I have code I want to run against the selected pivot table however the
> name of the pivot table is not constant nor is it always the first
> pivot table on a given sheet.
>
> Thanks
> Tim
>



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
determine in datasource or pivot table rodchar Microsoft Excel Misc 0 23rd Mar 2009 05:34 PM
determine the name of the selected pivot table Tim879 Microsoft Excel Programming 1 23rd Sep 2007 04:57 PM
determine if value in pivot table =?Utf-8?B?Z2VlYmVl?= Microsoft Excel Programming 0 18th Sep 2007 07:48 PM
How to determine order of row fields in pivot table Joerg Mochikun Microsoft Excel Programming 1 27th Aug 2007 05:35 AM
Determine If Pivot Table Exists =?Utf-8?B?cmlkYXdn?= Microsoft Excel Programming 4 25th Sep 2006 08:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:54 PM.