D
Darren DeCoste
I have a simple pivot table on one sheet with the data on the second
sheet. I have added a command button and I would like the user to be
able to use it to refresh the data on the pivot table. I have
recorded the action and placed it in the code for the button but it
fails. Here is what I have recorded:
Private Sub rtable_Click()
ActiveSheet.PivotTables("PivotTable1").PivotSelect "'Part
Number'[All]", _
xllabelOnly
ActiveSheet.PivotTables("PivotTable1").refreshtable
End Sub
When I manually right click on the table and refresh it works with
noproblem.
When I use the button with code above I get the error:
Run Time error'1004'
RefreshTable methode of PivotTable class failed.
If I only use the second line of code I still get the same error.
What else can I do to get he Table to refresh using VB.
Any help is greatly appreciated.
Thank you,
Darren
sheet. I have added a command button and I would like the user to be
able to use it to refresh the data on the pivot table. I have
recorded the action and placed it in the code for the button but it
fails. Here is what I have recorded:
Private Sub rtable_Click()
ActiveSheet.PivotTables("PivotTable1").PivotSelect "'Part
Number'[All]", _
xllabelOnly
ActiveSheet.PivotTables("PivotTable1").refreshtable
End Sub
When I manually right click on the table and refresh it works with
noproblem.
When I use the button with code above I get the error:
Run Time error'1004'
RefreshTable methode of PivotTable class failed.
If I only use the second line of code I still get the same error.
What else can I do to get he Table to refresh using VB.
Any help is greatly appreciated.
Thank you,
Darren