Command Button to refresh Pivot tables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In case the users I will be sending my sheet to, don't have their pivot table
selected, how can I insert a command button that refreshes data, without them
having to select the red !

Thanks
 
You can add a button from Forms:
View > Toolbars > Forms.
Then drag and drop "Button onto the sheet"

Then hit Alt+F11 > Insert > New Module
Add this code
Sub RePvt()
ActiveWorkbook.RefreshAll
End Sub

Go back to the button > right click > Assign Macro > RePvt

Note, this will refresh ALL pivot tables in the workbook.

Regards
Jon
 
In case the users I will be sending my sheet to, don't have their pivot table
selected, how can I insert a command button that refreshes data, without them
having to select the red !

Thanks

Hi Ron,

Try using this line of code in the macro assigned to your button:

ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh

cheers,
troy.

Unprotect Any Spreadsheet... Without The Password... In Just Seconds
Get eXL_unProtect today for less than you'd pay for lunch!
www.eXtreme-eXcel.com
Don't Let Anyone Lock You Out Of A Spreadsheet Again!
 
Back
Top