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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
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.
 

Md1

Board Regular
Joined
May 23, 2003
Messages
126
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
 

Forum statistics

Threads
1,136,354
Messages
5,675,303
Members
419,560
Latest member
g3org

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