Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stopping pivot table refresh
I currently have a file built that allows users to see some calculations based upon what months they select from a form. They can select up to 48 months (past 4 years of data). Data is stored in 3 pivot tables and users see a report produced from this data. Once users select a number of months, they click on a button and the VBA starts. The code loops through each one of the 48 months to see if it has been selected, if it has, it is 'visible' in the pivot table. The code loops through all 48 months for the 3 pivot tables. This is what I need help with. Once the button is clicked and the code starts to run, it can take up to 25 minutes to finish since the pivot table is refreshed each time a month is hidden or unhidden. I've turned off the automatic calculation, but that does not stop the pivot table refreshing. Any thoughts on how to stop the pivot tables from refreshing until all of the months have looped through? Thanks, -Scott --- Sheets("Pivot").Select With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Fiscal Month") For x = 0 To (MonthListSize - 1) .PivotItems(MonthList(x, 0)).Visible = MonthList (x, 1) Next x End With Sheets("Pivot - Geo").Select With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Fiscal Month") For x = 0 To (MonthListSize - 1) .PivotItems(MonthList(x, 0)).Visible = MonthList (x, 1) Next x End With Sheets("Pivot - Industry").Select With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Fiscal Month") For x = 0 To (MonthListSize - 1) .PivotItems(MonthList(x, 0)).Visible = MonthList (x, 1) Next x End With |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stopping pivot table refresh
Scott, if you try this at the beginning of your code it
may help Application.ScreenUpdating = False This stops the screen trying to continually refresh and can produce some siginificant performance gains -----Original Message----- I currently have a file built that allows users to see some calculations based upon what months they select from a form. They can select up to 48 months (past 4 years of data). Data is stored in 3 pivot tables and users see a report produced from this data. Once users select a number of months, they click on a button and the VBA starts. The code loops through each one of the 48 months to see if it has been selected, if it has, it is 'visible' in the pivot table. The code loops through all 48 months for the 3 pivot tables. This is what I need help with. Once the button is clicked and the code starts to run, it can take up to 25 minutes to finish since the pivot table is refreshed each time a month is hidden or unhidden. I've turned off the automatic calculation, but that does not stop the pivot table refreshing. Any thoughts on how to stop the pivot tables from refreshing until all of the months have looped through? Thanks, -Scott --- Sheets("Pivot").Select With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Fiscal Month") For x = 0 To (MonthListSize - 1) .PivotItems(MonthList(x, 0)).Visible = MonthList (x, 1) Next x End With Sheets("Pivot - Geo").Select With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Fiscal Month") For x = 0 To (MonthListSize - 1) .PivotItems(MonthList(x, 0)).Visible = MonthList (x, 1) Next x End With Sheets("Pivot - Industry").Select With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Fiscal Month") For x = 0 To (MonthListSize - 1) .PivotItems(MonthList(x, 0)).Visible = MonthList (x, 1) Next x End With . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
slow document / pivot table refresh and pivot function | Excel Discussion (Misc queries) | |||
Stopping a pivot table from reformatting column sizes and widths | Excel Discussion (Misc queries) | |||
Create refresh button in worksheet to refresh Pivot Table Data | Excel Worksheet Functions | |||
refresh a new worsheet on pivot table refresh | Excel Worksheet Functions | |||
Pivot Table refresh | Excel Discussion (Misc queries) |