ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel: How to generate a list of pivot tables in a file (https://www.excelbanter.com/excel-programming/378286-excel-how-generate-list-pivot-tables-file.html)

nj

Excel: How to generate a list of pivot tables in a file
 
I've for a TOC for the sheet and can use "Paste List" to get a list of
named ranges, but can someone point me towards the code for generating
a list of the pivot tables in a file?

I'm needing to go thru the file clean up the naming conventions and
then update the subroutines to use the updated names.

Something comparable to ActiveWorkbook.Sheets.Count, I guess?

Thanks,
Neva


Charles Chickering

Excel: How to generate a list of pivot tables in a file
 
Sub ListPivotTables()
Dim PT As PivotTable
Dim Sh As Worksheet
Dim lSh As Worksheet 'Loop Sheet
Set Sh = Worksheets.Add
Sh.Range("A1") = "Pivot Table Name"
For Each lSh In ActiveWorkbook.Worksheets
For Each PT In lSh.PivotTables
Sh.Range("A" & Sh.Rows.Count).End(xlUp).Offset(1) = PT.Name
Next
Next
End Sub
--
Charles Chickering

"A good example is twice the value of good advice."


"nj" wrote:

I've for a TOC for the sheet and can use "Paste List" to get a list of
named ranges, but can someone point me towards the code for generating
a list of the pivot tables in a file?

I'm needing to go thru the file clean up the naming conventions and
then update the subroutines to use the updated names.

Something comparable to ActiveWorkbook.Sheets.Count, I guess?

Thanks,
Neva



nj

Excel: How to generate a list of pivot tables in a file
 
Perfect - thanks!



All times are GMT +1. The time now is 05:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com