VBA move print area down 1 row from active cell

willow1985

Well-known Member
Joined
Jul 24, 2019
Messages
929
Office Version
  1. 365
Platform
  1. Windows
Hello,

I was just wondering what would be the code to adjust a print area down 1 row without using specific ranges?

I currently have a macro that finds the end of a table and adds a row for new data however I would like to expand the print area after I add the row by 1 row.

the only code I know is: ActiveSheet.PageSetup.PrintArea = "your range"

Any help would be appreciated.


Thank you :)

Carla
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Not sure I understand exactly what you want. This offsets the print area by 1 row and adds 1 more row to it. Adjust to suit ...
Code:
Sub try()
With ActiveSheet
   .PageSetup.PrintArea = _
       .Range("Print_Area").Offset(1).Resize(.Range("Print_Area").Rows.Count + 1, _
       .Range("Print_Area").Columns.Count).Address
End With
End Sub
 
Upvote 0
My mistake, the selected cell actually ends up just below the page break line so this code actually moves it one row lower than required. How could I adjust this code that it is even with the selected cell?
 
Upvote 0
Nevermind, figured it out:

Code:
    With ActiveSheet   .PageSetup.PrintArea = _
       .Range("Print_Area").Offset(0).Resize(.Range("Print_Area").Rows.Count + 1, _
       .Range("Print_Area").Columns.Count).Address
End With

Thank you very much!!! :)
 
Upvote 0
If you are Offsetting by 0 then you might as well just remove it :rofl:
 
Upvote 0
Nevermind, figured it out:

Code:
    With ActiveSheet   .PageSetup.PrintArea = _
       .Range("Print_Area").Offset(0).Resize(.Range("Print_Area").Rows.Count + 1, _
       .Range("Print_Area").Columns.Count).Address
End With

Thank you very much!!! :)
You are welcome - thanks for the reply.
 
Upvote 0
Actually this does not work. It is still moving down one row more than I need. Not sure how to adjust it that it moves to the selected cell...
 
Upvote 0
Played around a bit and so far this is working:

Code:
   .PageSetup.PrintArea = _       .Range("Print_Area").Offset(2).Resize(.Range("Print_Area").Rows.Count - 1, _
       .Range("Print_Area").Columns.Count).Address
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,126
Members
453,021
Latest member
Justyna P

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