Forum Discussion
Create a button to refresh pivot tables in a file
Dear Pierre,
First and foremost, add the (Developer Tab) to your Excel Ribbon, and follow these steps:
- Go to Insert at the Developer Tab, and click on it.
- You will find two sections: Forms Controls and ActiveX Control, in the ActiveX Control Section, select the command button, and add it to your sheet.
- Double click on the button, to open the VBA Editor, but before that, make sure that the design mode is turned on.
- Copy this command, and paste it in the VBA editor:
ActiveSheet.PivotTables("Your Pivot Table Name").PivotCache.Refresh |
So it would look as follows:
- Add your pivot table name to the code, and save it.
- Close VBA Editor
- Turn Design Mode off
- You have to save your workbook in one of these formats: (XLSM, XLSB, XLS), in order to save Refresh code.
Enjoy :)