Invalid Procedure Call or Argument?

Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)

Dim strPTName As String
Dim lngPTIndex As Long
Dim strCurrentPage As String

strPTName = Target.Name
strCurrentPage = Target.PivotFields("Name").CurrentPage

Application.EnableEvents = False

For lngPTIndex = 1 To Target.Parent.PivotTables.Count
If Target.Parent.PivotTables(lngPTIndex).Name = strPTName Then
[color=Blue]Target.Parent.PivotTables(lngPTIndex).PivotFields("Name").CurrentPage = strCurrentPage[/color]
End If
Application.EnableEvents = True

End Sub

The debugger in Excel points to the blue section
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!