Pivot Table Refreshes Via Code

E

EA

Private Sub RefreshButton_Click()
ActiveSheet.PivotTables("NewPT1").PivotCache.Refresh
ActiveSheet.PivotTables("NewPT2").PivotCache.Refresh
End Sub

When the above procedure runs, when the PivotTable is larger than the last
one, I get a dialog box asking me if I wish to overwrite the existing cells,
even though the existing cells are blank. Is there a way I can avoid this,
either by adding to my code, or some additional property of the pivoit
tables?

EA
 
W

WhytheQ

Sorry for not fully trusting you : are the cells it is trying to expand
into really empy? Have any of them got carriage returns in them?
Try Range ("C13:D15").ClearContents in the immediate window on the area
it is trying to expand into an dthen run the code.

j
 
E

EA

The cells are most definitely empty.

The size of the Pivot table expands as the day of the month increases. At
the end of the month there are 30/31 days worth of info. At the start of
next month the number reduces to one. Then on every subsequent refresh, as
more days are added, the dialog box appears...

EA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top