PC Review


Reply
Thread Tools Rate Thread

accessing pivot talbes using dom

 
 
Sean Farrow
Guest
Posts: n/a
 
      14th Feb 2009
Hi:
How can I enumerate all he pivot tables in a work book using the dom/vb
code?
Cheers
Sean.


 
Reply With Quote
 
 
 
 
Hong Quach
Guest
Posts: n/a
 
      14th Feb 2009
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.
>
>
>

 
Reply With Quote
 
Sean Farrow
Guest
Posts: n/a
 
      15th Feb 2009
Hi:
Just what I needed.
Sean.
"Hong Quach" <(E-Mail Removed)> wrote in message
news:B98BF97B-FF52-42BB-9BFA-(E-Mail Removed)...
> 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.
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing data in pivot tables davidhwang@usa.com Microsoft Excel Programming 2 12th Jun 2006 04:33 PM
Accessing Pivot Table's Data in VBA spjoseph0511 Microsoft Excel Programming 3 14th Nov 2003 03:15 AM
Accessing Pivot Table's Data spjoseph0511 Microsoft Excel Programming 1 13th Nov 2003 07:36 PM
Accessing pivot table's data spjoseph0511 Microsoft Excel Misc 0 6th Nov 2003 03:59 PM
Printing Talbes Keith Smith Windows XP Internet Explorer 0 11th Aug 2003 11:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:07 PM.