?
Solved

vba help

Posted on 2014-11-14
2
Medium Priority
?
95 Views
Last Modified: 2014-11-14
Hi

i am looking for a vba code that when i run in a workbook with so many pivot tables, in a new sheet it would create a report like below

Pivot Table Name   like this  Pivottable1
Pivot Table data source SheetName  like Sheet1 etc
Pivot table Data source range address like A1:D400

in addition if it also can put the pivot table data source background color

thanks,.
0
Comment
Question by:Flora
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 26

Accepted Solution

by:
ProfessorJimJam earned 2000 total points
ID: 40443291
here it is

Sub listpp()

 Dim pvt As PivotTable
 Dim iSht As Long
 Dim iRow As Integer

 Application.ScreenUpdating = False
 Set objNewSheet = Worksheets.Add
 objNewSheet.Activate

 iRow = 2
 iSht = 2

 'SET TITLES
 Range("A1").FormulaR1C1 = "Name"
 Range("B1").FormulaR1C1 = "Source"
 Range("C1").FormulaR1C1 = "Refreshed by"
 Range("D1").FormulaR1C1 = "Refreshed"
 Range("E1").FormulaR1C1 = "Sheet"
 Range("F1").FormulaR1C1 = "Location"

 'GET PIVOT DETAILS
 Do While iSht <= Worksheets.Count
 Sheets(iSht).Select

 For Each pvt In ActiveSheet.PivotTables
 objNewSheet.Cells(iRow, 1).Value = pvt.Name
 objNewSheet.Cells(iRow, 2).Value = pvt.SourceData
 objNewSheet.Cells(iRow, 3).Value = pvt.RefreshName
 objNewSheet.Cells(iRow, 4).Value = pvt.RefreshDate
 objNewSheet.Cells(iRow, 5).Value = ActiveSheet.Name
 objNewSheet.Cells(iRow, 6).Value = pvt.TableRange1.Address
 iRow = iRow + 1
 Next

 iSht = iSht + 1
 Loop

 objNewSheet.Activate

 Application.ScreenUpdating = True

 End Sub

Open in new window

0
 
LVL 6

Author Closing Comment

by:Flora
ID: 40443308
thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question