View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Hans Hans is offline
external usenet poster
 
Posts: 25
Default control many pivot tables

Hi

I was working on the same problem yesterday. Maybe this
macro helps:

(The bPeriod referes to a cell on a normal sheet; you
could change it to an Input box if you want)


Sub PivotChangePeriod()
'this macro changes the period in the pivottables
'in sheets LI(cc) and LP(cc)to the current
'period (mentioned on sheet OVERVIEW, range is
'called period)

Dim bPeriod As Byte
Dim PT As PivotTable
Dim PTS As PivotTables
Dim Sh1 As Sheets
Dim wk As Worksheet

bPeriod = Range("period").Value
Set Sh1 = Worksheets(Array("LI(cc)", "LP(cc)")

For Each wk In Sh1
For Each PT In wk.PivotTables
With PT
.PivotFields("period").CurrentPage = bPeriod
End With
Next PT
Next wk
End Sub


regards, Hans
-----Original Message-----
i have many pivot tables in a workbook, and i want to

find way to
control all of them toghter. i mean for example: if i

have many pivot
tables and i want to change the month (date) in all of

them togther.
help!!!


---
Message posted from http://www.ExcelForum.com/

.