Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default pivottable page fields

Hi there,

Is there any way to return the actual page field that was
changed from the Private Sub Worksheet_Change(ByVal
Target As Range) procedure?

The value Target returns is the entire range of the
pivottable, not just the page field range cell that was
changed.

Any ideas?

Grant.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default pivottable page fields

You could use a module level variable to track the page field values.
For example:

'===========================
Option Explicit
Dim mvPivotPage1 As Variant
Dim mvPivotPage2 As Variant

Private Sub Worksheet_Change(ByVal Target As Range)
Dim pt As PivotTable
Dim pf1 As PivotField
Dim pf2 As PivotField

Set pt = ActiveSheet.PivotTables(1)
Set pf1 = pt.PageFields(1)
Set pf2 = pt.PageFields(2)

If LCase(pf1.CurrentPage) _
< LCase(mvPivotPage1) Then
MsgBox "Page field " & pf1.Name & " was changed"
Else
If LCase(pf2.CurrentPage) _
< LCase(mvPivotPage2) Then
MsgBox "Page field " & pf2.Name & " was changed"
End If
End If
mvPivotPage1 = pf1.CurrentPage
mvPivotPage2 = pf2.CurrentPage

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


Grant wrote:
Hi there,

Is there any way to return the actual page field that was
changed from the Private Sub Worksheet_Change(ByVal
Target As Range) procedure?

The value Target returns is the entire range of the
pivottable, not just the page field range cell that was
changed.

Any ideas?

Grant.




--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

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
2003 PIvotTable Calculated Fields Kay Excel Discussion (Misc queries) 3 April 24th 10 06:41 PM
Pivottable Sum of fields. Saviz Excel Discussion (Misc queries) 1 July 17th 08 12:10 PM
pivottable calculated fields HelpAl Excel Discussion (Misc queries) 3 December 8th 05 10:18 PM
Sorting Page fields in PivotTable Todd Huttenstine Excel Programming 1 May 14th 04 08:57 PM
How to replace PivotTable data fields...? Robert Stober Excel Programming 6 October 17th 03 10:00 PM


All times are GMT +1. The time now is 07:26 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"