Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

determine the name of the selected pivot table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tim879 - 23 Sep 2007 16:43 GMT
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 - 23 Sep 2007 16:57 GMT
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

> 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.

Signature

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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.