Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Cycle through Pivot Tables with Pivot Items

All,

I am having a few problems.

Situation:

I have 20 Pivot tables. Most have Country Code and all have a staton
code.

I need my code to
1) Get the first country code
2) Update all Pivot tables where country code exists in the Pivot table
3) Print it
4) Next country code

I have code to print the sheets to PDF
And the code below changes only one of my tables (Though it shows it is
referenceing all my tables)

Any ideas?

Code:

Sub Internet()
'Got this off the internet

Dim PI as PivotItem
Dim PF as PivotField
Dim I as Integer

' This allows the macro to run but still shows below it is doing
something to a
'Pivot table where the item does not exsist

On Error Resume Next

I = 0

Set PF = Worksheets("Test").Pivotfields("Country Cd")

For Each PT in worksheets("test").PivotTables

For Each PI in PF.PivotItems

PF.CurrentPage = PI.value

If worksheet('test").Range("B12") = "0" then
'Do nothing No data for the country
Else
I = I + 1
'Test Junk
Worksheets("sheet2").Cells(I,1) = PI.Value
' Sheet two lists all countrys with more than one record 20 times one
for each pivot table
' even though it only changed one pivottable
' Add call to print here
' MsgBox "Working on " & PT 'This shows all the pivot tables one at a
time even thought
'Its not doing anyting to
them
End IF
Next
Next PT

End Sub



So, how to get it to loop and how to avoid the pivot table with out
Country Cd in it?

Doug

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
pivot tables: Calculated fields among *row* items [email protected] Excel Discussion (Misc queries) 0 May 7th 08 07:46 PM
Name items in Pivot Tables? Sheila D Excel Discussion (Misc queries) 4 December 1st 06 01:54 PM
ticked items on Pivot tables Matt123 Excel Discussion (Misc queries) 1 October 11th 06 10:13 PM
Pivot tables - calculated fields and items Tim Wheeler Excel Discussion (Misc queries) 5 May 19th 06 10:06 PM
show items with no data option in pivot tables AHuntington Excel Discussion (Misc queries) 2 August 23rd 05 01:30 PM


All times are GMT +1. The time now is 04:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"