LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Pivot Multi Page Diff Change

Dear Debra,

Thank You. Thank you for taking the time and your for your response. My
pivot tables use an external database. Your code worked when the data source
is from an excel spreadsheet. However, I could not get it to work for the
external data source.

Michael

--
Newbie trying to learn VBA


"Debra Dalgleish" wrote:

You could use the following code that will match all the page fields,
based on an update to any one of the pivot tables on the same sheet:

'======================================
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
On Error Resume Next
Dim ws As Worksheet
Dim ptMain As PivotTable
Dim pt As PivotTable
Dim pfMain As PivotField
Dim pi As PivotItem
Dim pf As PivotField

On Error Resume Next
Set ws = ActiveSheet
Set ptMain = Target

Application.EnableEvents = False
Application.ScreenUpdating = False

For Each pfMain In ptMain.PageFields
For Each pt In ws.PivotTables
If pt.Name < ptMain.Name Then
For Each pf In pt.PageFields
If pf.Name = pfMain.Name Then
If pfMain.CurrentPage = "(All)" Then
pf.CurrentPage = "(All)"
Exit For
Else
For Each pi In pf.PivotItems
If pi.Name = pfMain.CurrentPage Then
pf.CurrentPage = pi.Name
Exit For
End If
Next pi
End If
End If
Next pf
End If
Next pt
Next pfMain

Application.EnableEvents = True
Application.ScreenUpdating = True

End Sub
'===================================

xlMS2SF wrote:
I need help adapting VBA code that I found on Contextures.com

When the end user chooses the two page fields in ptMain, I need it to
automatically enter it in pt2, pt3 and pt4. pt2 is on the same page as
ptMain. All four pivot tables use the same page filter.

Here is code, I just don't know how to adapt.
=================



--
Debra Dalgleish
Contextures
www.contextures.com/tiptech.html
Blog: http://blog.contextures.com


 
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
Diff page margins in the same sheet Others Setting up and Configuration of Excel 2 October 8th 09 12:43 PM
Pivot Table Page Change Code PFLY Excel Discussion (Misc queries) 1 May 16th 08 12:42 AM
Get header only on first page of multi page excel file betwms Excel Discussion (Misc queries) 3 March 29th 06 05:47 PM
How to change default page setup for pivot tables? bobs Excel Discussion (Misc queries) 1 January 5th 05 09:42 PM
Hide a page in a multi page userform Ian Mangelsdorf Excel Programming 1 October 27th 04 09:06 AM


All times are GMT +1. The time now is 10:03 PM.

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

About Us

"It's about Microsoft Excel"