Build Macro to Print

estrauss22

New Member
Joined
Jul 5, 2007
Messages
32
I currently have a report that is feed by a pivot table. Each time you change the filter on the pivot table, new data comes up and alters the report. What I would like to do is be able to print a series of different reports, each with a different filter. I've tried to build a macro that would go through and select the various filters I want and print them, rather than having to manually select the filters each time I open the file. The problem I am having is that whenever I initiate the macro, it will not clear what was already selected in the report. I have various people, printing various reports and each time they print, whatever data was last loaded by the previous user is present on the new report as well. Is there a code I can write that would allow me to start with a clear pivot table each time?
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

ravishankar

Well-known Member
Joined
Feb 23, 2006
Messages
3,566
HI
Try inserting this code before next report is generated.
Range("A1:Z250").clearcontents
Ravi
 

estrauss22

New Member
Joined
Jul 5, 2007
Messages
32
When I do the clear contents code - it deletes the entire page (included the pivot table) I need to keep the pivot, clear the filters, and start fresh.
 

ravishankar

Well-known Member
Joined
Feb 23, 2006
Messages
3,566
Hi
I gave a hypothetical range as A1:Z250. You have adjust it to delete what you don't need. I wouldn't have a clue where your pivot tables appear.
Ravi
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,872
Messages
5,766,864
Members
425,382
Latest member
IronM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top