ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA and Pivot Table Refresh (https://www.excelbanter.com/excel-programming/378448-vba-pivot-table-refresh.html)

alondon

VBA and Pivot Table Refresh
 
Folks,

I posted this question about 3 weeks ago but got no response - probably
because I didnt make it clear what the problem was.

I need to build a very complex report using on about 30,000 records using
Pivot Tables. I got everything to work UNTIL I tried selecting (and
de-selecting) items within a field. Each time a field is set (Include or Do
Not Include) using VBA, the Pivot Table recomputes.

Depending on the month selected by the user, I need to set 12 items in the
MONTH field to True(include) or False (don't include). But, I don't want the
Pivot Table to refresh for each change as it takes about 10 seconds each
time. I want to make the 12 changes, then refresh the table - the same way
it works when making changes on the screen in Excel.

I have already tried .Pivot.EnableRefresh = False - that only turns off
manual refresh. I tried placing multiple items in a .PivotItems statement
(e.g. .PivotItems("10/1/2007", "11/1/2007").Visible = True), but only a
single argument is allowed.

Bummer! I am was so close to creating something really cool. What am I
overlooking here? Anybody have any ideas?

Thanks for your help,

Allan P. London, CPA




bz

VBA and Pivot Table Refresh
 
"alondon" wrote in
:

Folks,

I posted this question about 3 weeks ago but got no response - probably
because I didnt make it clear what the problem was.

I need to build a very complex report using on about 30,000 records
using Pivot Tables. I got everything to work UNTIL I tried selecting
(and de-selecting) items within a field. Each time a field is set
(Include or Do Not Include) using VBA, the Pivot Table recomputes.

Depending on the month selected by the user, I need to set 12 items in
the MONTH field to True(include) or False (don't include). But, I don't
want the Pivot Table to refresh for each change as it takes about 10
seconds each time. I want to make the 12 changes, then refresh the
table - the same way it works when making changes on the screen in
Excel.

I have already tried .Pivot.EnableRefresh = False - that only turns off
manual refresh. I tried placing multiple items in a .PivotItems
statement (e.g. .PivotItems("10/1/2007", "11/1/2007").Visible = True),
but only a single argument is allowed.

Bummer! I am was so close to creating something really cool. What am I
overlooking here? Anybody have any ideas?


Have you tried
Application.EnableEvents = False
.... do your things
Application.EnableEvents = True




--
bz

please pardon my infinite ignorance, the set-of-things-I-do-not-know is an
infinite set.

remove ch100-5 to avoid spam trap


All times are GMT +1. The time now is 12:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com