View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Maggie Maggie is offline
external usenet poster
 
Posts: 57
Default Macro to Auto-refresh a pivot table

On Mar 20, 2:44*pm, wrote:
On Mar 19, 6:55*pm, Maggie wrote:





On Mar 19, 12:30*pm, wrote:


On Mar 19, 11:14*am, Maggie wrote:


I have a worksheet that is constantly changing and I want my pivot
table to change when my worksheet changes automatically without having
to hit the refresh button. *Is there a macro out there that will do
that?


Maggie,


If you run the macro recorder to get the code for a pivot table
refresh you will get something similar to the following:


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


You can have this run after your "worksheet changes automatically."


Best,


Matt Herbert


That did not work when I tried that. *Is there anything else that is
possible?- Hide quoted text -


- Show quoted text -


Maggie,

You would need to provide more detail on how your "worksheet changes
automatically." *It's hard to determine how to help without more
detail. *If you are unable to tie the pivot refresh to the procedure,
event, or other mechanism that changes your worksheet then the only
other solution I can think of right now is to set something up with
OnTime. *VBE help has good documentation for this method.

Best,

Matt- Hide quoted text -

- Show quoted text -


Here is my macro but I am having issues with it and it will not auto
refresh.

Sub Macro2()
'
' Keyboard Shortcut: Ctrl+u
Sheets("Residential Data").Select
Range("W3:W103").Select
Sheets("Pivot").Select
ActiveSheet.PivotTables("PivotTable2").PivotCache. Refresh
End Sub