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

I am working with a spreadsheet that contains 15 pivot tables, and I am
writing a macro to update them programatically. Is there a way to list ALL
the pivot tables in a sheet without actually going to them and
right-clicking, going to Table Options and seeing the name there? TIA
--
Greg Tan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default List PivotTables

Sub ListPivots()
Dim myPivot As PivotTable
Dim myCounter As Long
myCounter = 1
For Each myPivot In ActiveSheet.PivotTables
Cells(myCounter, 1).Value = myPivot.Name
myCounter = myCounter + 1
Next
End Sub

This puts the first pivot name into A1, next in A2 and so on so you may want
to adjust the code to avoid overtyping existing data!

"Greg Tan" wrote:

I am working with a spreadsheet that contains 15 pivot tables, and I am
writing a macro to update them programatically. Is there a way to list ALL
the pivot tables in a sheet without actually going to them and
right-clicking, going to Table Options and seeing the name there? TIA
--
Greg Tan

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default List PivotTables

Wow that is so cool. How would I get this to write somewhere other than A1?
Thanks so much for this.
--
Greg Tan


"Martin" wrote:

Sub ListPivots()
Dim myPivot As PivotTable
Dim myCounter As Long
myCounter = 1
For Each myPivot In ActiveSheet.PivotTables
Cells(myCounter, 1).Value = myPivot.Name
myCounter = myCounter + 1
Next
End Sub

This puts the first pivot name into A1, next in A2 and so on so you may want
to adjust the code to avoid overtyping existing data!

"Greg Tan" wrote:

I am working with a spreadsheet that contains 15 pivot tables, and I am
writing a macro to update them programatically. Is there a way to list ALL
the pivot tables in a sheet without actually going to them and
right-clicking, going to Table Options and seeing the name there? TIA
--
Greg Tan

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default List PivotTables

One way would be to make the Counter=20 to start at A20 or change
Cells(Counter,1) to Cells(Counter, 10) to start at J1 [Cells uses
coordinates, row then column]. If you don't want it in the sheet at all, you
could replace the whole thing with:

Sub ListPivots()
Dim myPivot As PivotTable
For Each myPivot In ActiveSheet.PivotTables
Debug.Print myPivot.Name
Next
End Sub

This will dump the list in the Immediate window (found under View in the VB
Editor).


"Greg Tan" wrote:

Wow that is so cool. How would I get this to write somewhere other than A1?
Thanks so much for this.
--
Greg Tan


"Martin" wrote:

Sub ListPivots()
Dim myPivot As PivotTable
Dim myCounter As Long
myCounter = 1
For Each myPivot In ActiveSheet.PivotTables
Cells(myCounter, 1).Value = myPivot.Name
myCounter = myCounter + 1
Next
End Sub

This puts the first pivot name into A1, next in A2 and so on so you may want
to adjust the code to avoid overtyping existing data!

"Greg Tan" wrote:

I am working with a spreadsheet that contains 15 pivot tables, and I am
writing a macro to update them programatically. Is there a way to list ALL
the pivot tables in a sheet without actually going to them and
right-clicking, going to Table Options and seeing the name there? TIA
--
Greg Tan

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default List PivotTables

Thanks! I am not that great at programming, and i did not realize the
counter defaults to the first cell in the sheet. The other part (listing the
pivot tables) works awesome, this will just be the icing on the cake. Thanks
very much!
--
Greg Tan


"Martin" wrote:

One way would be to make the Counter=20 to start at A20 or change
Cells(Counter,1) to Cells(Counter, 10) to start at J1 [Cells uses
coordinates, row then column]. If you don't want it in the sheet at all, you
could replace the whole thing with:

Sub ListPivots()
Dim myPivot As PivotTable
For Each myPivot In ActiveSheet.PivotTables
Debug.Print myPivot.Name
Next
End Sub

This will dump the list in the Immediate window (found under View in the VB
Editor).


"Greg Tan" wrote:

Wow that is so cool. How would I get this to write somewhere other than A1?
Thanks so much for this.
--
Greg Tan


"Martin" wrote:

Sub ListPivots()
Dim myPivot As PivotTable
Dim myCounter As Long
myCounter = 1
For Each myPivot In ActiveSheet.PivotTables
Cells(myCounter, 1).Value = myPivot.Name
myCounter = myCounter + 1
Next
End Sub

This puts the first pivot name into A1, next in A2 and so on so you may want
to adjust the code to avoid overtyping existing data!

"Greg Tan" wrote:

I am working with a spreadsheet that contains 15 pivot tables, and I am
writing a macro to update them programatically. Is there a way to list ALL
the pivot tables in a sheet without actually going to them and
right-clicking, going to Table Options and seeing the name there? TIA
--
Greg Tan

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
PivotTables Gerry Verschuuren Excel Discussion (Misc queries) 4 October 25th 07 01:12 AM
PivotTables KerryK Excel Discussion (Misc queries) 2 October 8th 07 07:06 PM
Create a summary list without using PivotTables? Jaye Excel Worksheet Functions 8 October 27th 05 03:30 AM
New to Pivottables- need help coal_miner Charts and Charting in Excel 1 June 6th 05 06:48 PM
PivotTables/VBA jngi[_3_] Excel Programming 2 September 24th 04 12:27 PM


All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"