Auto Update of Pivot Table [Pls help ]

-=Kid=-

New Member
Joined
Nov 16, 2005
Messages
11
Hi, now i am trying to update the pivot table when the spreadsheet is being call.

I use the following method in the project explorer

Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Worksheets("PivotTable").PivotTables(3).PivotCache.Refresh
End Sub

Worksheets("PivotTable") is my spreadsheet name
PivotTables(3) is the name of my pivot table

but i still hit a error

Run-time error '1004':
Unable to get the PivotTables property of the Worksheet Class

I have try :

changing Worksheets("PivotTable") to Worksheets(3)
changing the name of my pivot table

Any1 know why ? Thx in advance :wink:

[/img]
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

BrianB

Well-known Member
Joined
Feb 17, 2003
Messages
8,127
Here are a couple of alternatives :-
Code:
Worksheets("PivotTable").PivotTables(3).RefreshTable
Worksheets("PivotTable").Range("A1").PivotTable.RefreshTable
 

Watch MrExcel Video

Forum statistics

Threads
1,118,081
Messages
5,570,092
Members
412,310
Latest member
mark884
Top