Is it possible to programmatically set the selection in a Page Field based on the contents of a named field?
I've tried the following code but the Pivot Opens showing (All) in the page field.
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Login = "Bob" Then
ActiveSheet.PivotTables("PivotTable1").PivotFields("Department").CurrentPage = _
"Warehouse"
ElseIf Login = "Mary" Then
ActiveSheet.PivotTables("PivotTable1").PivotFields("Department").CurrentPage = _
"Operations"
Else
ActiveSheet.PivotTables("PivotTable1").PivotFields("Department").CurrentPage = _
"Logistics"
End If
End Sub
Any help would greatly appreciated
I've tried the following code but the Pivot Opens showing (All) in the page field.
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Login = "Bob" Then
ActiveSheet.PivotTables("PivotTable1").PivotFields("Department").CurrentPage = _
"Warehouse"
ElseIf Login = "Mary" Then
ActiveSheet.PivotTables("PivotTable1").PivotFields("Department").CurrentPage = _
"Operations"
Else
ActiveSheet.PivotTables("PivotTable1").PivotFields("Department").CurrentPage = _
"Logistics"
End If
End Sub
Any help would greatly appreciated