Controlling Pivot Table Page-Field

Q

Qull666

Controlling Pivot Table Page Field.

Thank you for looking at this query, I have tried the code, but there is an
error.



I have tried this code, but ran into run-time error:
"Unable to set the_Default Property of the Pivot Item class"

What I have done:
1.Cell C2: key in date (31/03/07 or 28/02/07)
2.Cell C2: use vlookup & indexmatch, it doesn't change the PivotField,
PageField.


---Taken from the community-------------------------------

Private Sub Worksheet_Change(ByVal Target As Range)
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Set pt = Worksheets("Sales Pivot").PivotTables(1)
Set pf = pt.PageFields("End-Mth")

If Target.Address = "$C$2" Then

Application.EnableEvents = False
For Each pi In pf.PivotItems
If LCase(pi.Value) = LCase(Target.Value) Then
pf.CurrentPage = pi.Value
Exit For
End If
Next pi
Application.EnableEvents = True

End If

End Sub




What I wanna do:
Cell C2: Use Reference formulas to change Pivot-PageField

Sheet 1: Data entry
Sheet 2: Central Control (this is where C2 is AND uses Vlookup & IndexMatch)
Sheet 3: Pivot Table (change according to sheet 1)



Thank you for the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top