using automatic macros or object macros

G

Guest

hello,

i tried using the following code in a command button macro
*************************************
Sheets("Pivot of Data Collection").Select
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
Sheets("Download Pivot").Select
ActiveSheet.PivotTables("PivotTable3").PivotCache.Refresh

*************************************
and also in a worksheet, worksheet activate and then when i changed
worksheet or clicked the command button it threw an error at me when it tried
to run the macro, it doesn't seem to be able to use the code above
 
T

Tom Ogilvy

The code worked fine for me in a comandbutton click event. (only place
tested).

xl2002
 

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