View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Debra Dalgleish Debra Dalgleish is offline
external usenet poster
 
Posts: 2,979
Default Excel Pivot Table link page field to spreadsheet cell

You could use event code on the sheet that contains the data validation
dropdown. For example, if the dropdown is in cell C2, and the pivot
table is on a sheet named Sales Pivot, right-click on the sheet tab for
the data validation sheet and add the following code:

'========================
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("Region")

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
'=====================

excel misc wrote:
Is it possible to link the page field in a pivot table to a cell in
the spreadsheet?

I want to select a value from a validation list in cell, c3 on sheet1
and have this value be the page field value.

Thanks



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