Setting print area

Md1

Board Regular
Joined
May 23, 2003
Messages
126
Hi all

I'm sure this is something simple......but

I have two pivot tables which depending on which criteria I select, change size, one one of them the 'print area' changes size when the pivot changes size and the other doesn't meaning I have to manually change the print area.

The pivots have exactly the same info in and have been set with the same margins etc but for some reason only one of them prints without me having to manually change the print area. As the prints are all macro driven this is causing a real pain.

Any help would be great

regards

Md1
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
This will set the PrintArea on Sheet1 to range occupied by the first PivotTable:

Code:
Sub Test()
    With Worksheets("Sheet1")
        .PageSetup.PrintArea = .PivotTables(1).TableRange2.Address
    End With
End Sub

The TableRange2 property includes the Page Fields. TableRange1 excludes them.
 
Upvote 0
Hi

I have created the same pivot table from scratch and it seems to be working perfectly again - not sure why it didn't like the previous table.

If it does it again I will use your code.

many thanks

Md1
 
Upvote 0

Forum statistics

Threads
1,211,853
Messages
6,104,371
Members
447,902
Latest member
chriswebs23

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
Back
Top