Maintain a Print Area even when rows or columns are deleted

lunbryd

New Member
Joined
Apr 12, 2019
Messages
2
I am looking to set up a Print Area on a sheet that will remain even when I delete columns. Currently my print area is A1:G24 and when I delete columns A and B, my print area becomes A1:E24. I would like to set up the print area so when columns within that range are deleted, the data that moves in from the columns outside that range now become part of the print area.

Thanks.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
.
Paste this in the Sheet Level Module :

Code:
Option Explicit


Private Sub Worksheet_Change(ByVal Target As Range)
    Worksheets("Sheet1").PageSetup.PrintArea = "$A$1:$G$24"
End Sub
 
Upvote 0
Try going to the Name Manager and changing the "Refers to:" of your print area from =Sheet1!$A$1:$G$24 to =INDIRECT("Sheet1!$A$1:$G$24")
 
Upvote 0
.
Paste this in the Sheet Level Module :

Code:
Option Explicit


Private Sub Worksheet_Change(ByVal Target As Range)
    Worksheets("Sheet1").PageSetup.PrintArea = "$A$1:$G$24"
End Sub

Try going to the Name Manager and changing the "Refers to:" of your print area from =Sheet1!$A$1:$G$24 to =INDIRECT("Sheet1!$A$1:$G$24")



These both worked for me. Thanks, guys.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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