S
Santhosh Mani
Please see below the code I am using to change a Pivot Table Field value by
typing the value required in another sheet - Cell. I am not an expert in
coding, and this code originally got from this group only. The problem is
that when I convert the 2003 format to 2007 this code is not working where as
it works perfect in 2003. In 2007 format gives error and focus to the line
"SubNum.CurrentPage = Pi.Value". Could you pls help to solve it
Thanks and regards - Santhosh Mani
----------------------
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Dim SubNum As PivotField
If Target.Count > 1 Then Exit Sub
If IsEmpty(Target.Value) Then Exit Sub
If Target.Address = "$F$4" Then
Worksheets("StmtData").PivotTables("PivotTable1").PivotCache.Refresh
Set SubNum = Worksheets("StmtData").PivotTables _
("PivotTable1").PageFields( _
"SubNo")
For Each Pi In SubNum.PivotItems
If Pi.Value = Target.Text Then
SubNum.CurrentPage = Pi.Value
Exit For
End If
Next
End If
End Sub
typing the value required in another sheet - Cell. I am not an expert in
coding, and this code originally got from this group only. The problem is
that when I convert the 2003 format to 2007 this code is not working where as
it works perfect in 2003. In 2007 format gives error and focus to the line
"SubNum.CurrentPage = Pi.Value". Could you pls help to solve it
Thanks and regards - Santhosh Mani
----------------------
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Dim SubNum As PivotField
If Target.Count > 1 Then Exit Sub
If IsEmpty(Target.Value) Then Exit Sub
If Target.Address = "$F$4" Then
Worksheets("StmtData").PivotTables("PivotTable1").PivotCache.Refresh
Set SubNum = Worksheets("StmtData").PivotTables _
("PivotTable1").PageFields( _
"SubNo")
For Each Pi In SubNum.PivotItems
If Pi.Value = Target.Text Then
SubNum.CurrentPage = Pi.Value
Exit For
End If
Next
End If
End Sub