Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 408
Default updating pivot charts with vba

I have two worksheets, one that contains the pivot tables and another that
contains the pivot charts. I programmed on the pivot tables worksheet that
when a selection is made from the pivot table dropdown all the other pivot
table selections are updated automatically to the selection. What im looking
to do though is on the pivot chart page, when i change the selection there
how does it change all the pivot chart selections automatically? Btw just in
case someone wants to change several pivot tables at once, this code might
help out for that. The code im using to change the pivot tables is:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim pt As PivotTable
Dim pf As PivotField
Dim pt1 As PivotTable
Dim pf1 As PivotField
Dim str As String
Dim counter As Integer
counter = 1

' Base table that gets updated
' PivotTable2 is the main table that is updated.
Set pt = Me.PivotTables("PivotTable2")
Set pf = pt.PivotFields("str_seg")

' User can't select the (All) selection
If pf.CurrentPage = "(All)" Then
pf.CurrentPage = "Nation"
MsgBox ("The display of (All) is disabled.")
End If

' 10 pivot tables on the work sheet, go through each one of them and update
the selections
While (counter <= 10)
Set pt1 = Me.PivotTables(counter)
Set pf1 = pt1.PivotFields("str_seg")
str = pf.CurrentPage
pf1.CurrentPage = str
counter = counter + 1
Wend

End Sub
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
Charts not updating vitorjose Excel Worksheet Functions 1 July 3rd 08 02:36 PM
Updating Charts Mike Charts and Charting in Excel 1 May 9th 07 01:36 PM
updating pie charts Lilsis7 Excel Discussion (Misc queries) 2 April 24th 06 01:21 PM
updating charts Jon Peltier[_8_] Excel Programming 0 August 24th 04 04:20 AM
updating charts Chip Pearson Excel Programming 0 August 20th 04 06:24 PM


All times are GMT +1. The time now is 12:44 PM.

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"