View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Hong Quach Hong Quach is offline
external usenet poster
 
Posts: 21
Default accessing pivot talbes using dom

Hi Sean,

Below is the vba code that you can use to walk through each PT in a workbook.

Sub enumeratePT()
Dim ws As Worksheet
Dim pt As PivotTable
For Each ws In ThisWorkbook.Worksheets
If ws.Visible = xlSheetVisible Then
ws.Select
For Each pt In ws.PivotTables
Debug.Print pt.Name
' pt.PageFields("COLUMN1").DataRange = "VALID VALUE IN COLUMN1"
' pt.PageFields("COLUMN2").DataRange = "VALID VALUE IN COLUMN2"
Next pt
End If
Next
End Sub

Hong Quach

"Sean Farrow" wrote:

Hi:
How can I enumerate all he pivot tables in a work book using the dom/vb
code?
Cheers
Sean.