Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CH CH is offline
external usenet poster
 
Posts: 49
Default Name of Pivot Table

Hi All,

In VBA script when it is running, is there a way to select any cell on the
pivot table and then obtain the name of the pivot table so that I can
manipulate it ?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Name of Pivot Table

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Intersect(Target, Me.PivotTables("PivotTable1").TableRange2) Is
Nothing Then

MsgBox Target.Address & " is part of PivotTable1"
End If
End Sub


--
__________________________________
HTH

Bob

"ch" wrote in message
...
Hi All,

In VBA script when it is running, is there a way to select any cell on the
pivot table and then obtain the name of the pivot table so that I can
manipulate it ?

Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default Name of Pivot Table

To get the name of the pivot table for the active cell:

'========================
Sub GetPTName()
Dim pt As PivotTable

On Error Resume Next
Set pt = ActiveCell.PivotTable

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

Set pt = Nothing
End Sub
'=====================

ch wrote:
Hi All,

In VBA script when it is running, is there a way to select any cell on the
pivot table and then obtain the name of the pivot table so that I can
manipulate it ?

Thanks.



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

  #4   Report Post  
Posted to microsoft.public.excel.programming
CH CH is offline
external usenet poster
 
Posts: 49
Default Name of Pivot Table

Thanks Debra, this works just fine.

"Debra Dalgleish" wrote:

To get the name of the pivot table for the active cell:

'========================
Sub GetPTName()
Dim pt As PivotTable

On Error Resume Next
Set pt = ActiveCell.PivotTable

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

Set pt = Nothing
End Sub
'=====================

ch wrote:
Hi All,

In VBA script when it is running, is there a way to select any cell on the
pivot table and then obtain the name of the pivot table so that I can
manipulate it ?

Thanks.



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


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
how to create pivot table from existing pivot table in excel 2007 Udayraj Dhulekar Excel Discussion (Misc queries) 2 July 8th 13 08:22 PM
Copying values from pivot table to cells outside pivot table richzip Excel Discussion (Misc queries) 4 January 16th 08 11:03 PM
Filter lines with Pivot table and non Pivot table columns Grover Excel Discussion (Misc queries) 1 September 26th 07 12:48 AM
Filter lines containing pivot table and non pivot table data Grover Excel Worksheet Functions 0 September 24th 07 07:20 PM
Help required with setting up a pivot table with the source on sheet1 to have the pivot table created on sheet called "report" Diana[_5_] Excel Programming 0 August 21st 03 10:19 PM


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