List of Pivot Tables and info

L

ldc

This worked great to list the pivot tables. Anything to show location of the
pivot table or the data range the pivot table is using?
 
M

Max

ldc said:
This worked great to list the pivot tables.
Anything to show location of the pivot table
or the data range the pivot table is using?

Hi, it's me again. I tinkered around with the macro recorder, and came up
with this slight revision to Charles' sub which seems to work ok
(PT.SourceData yields the desired source data range)

Sub ListPivotTablesNSource()
Dim PT As PivotTable
Dim Sh As Worksheet
Dim lSh As Worksheet 'Loop Sheet
Set Sh = Worksheets.Add
Sh.Range("A1") = "Pivot Table Name"
Sh.Range("B1") = "Pivot Table Source"
For Each lSh In ActiveWorkbook.Worksheets
For Each PT In lSh.PivotTables
With Sh.Range("A" & Sh.Rows.Count).End(xlUp)
.Offset(1, 0) = PT.Name
.Offset(1, 1) = PT.SourceData
End With
Columns("A:B").EntireColumn.AutoFit
Next
Next
End Sub


---
 
L

ldc

PERFECT!

Max said:
Hi, it's me again. I tinkered around with the macro recorder, and came up
with this slight revision to Charles' sub which seems to work ok
(PT.SourceData yields the desired source data range)

Sub ListPivotTablesNSource()
Dim PT As PivotTable
Dim Sh As Worksheet
Dim lSh As Worksheet 'Loop Sheet
Set Sh = Worksheets.Add
Sh.Range("A1") = "Pivot Table Name"
Sh.Range("B1") = "Pivot Table Source"
For Each lSh In ActiveWorkbook.Worksheets
For Each PT In lSh.PivotTables
With Sh.Range("A" & Sh.Rows.Count).End(xlUp)
.Offset(1, 0) = PT.Name
.Offset(1, 1) = PT.SourceData
End With
Columns("A:B").EntireColumn.AutoFit
Next
Next
End Sub


---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top