Macro/VBA to Set Print Area plus Blank Rows

wirra

New Member
Joined
Aug 20, 2006
Messages
23
Hi,

I need a macro to set the print area for the data in my worksheet plus 10 extra blank rows. In the example below I need to set the print area from A2 to E21. The amount of rows of actual data will change regularly but the columns will stay the same ie. A to E. So in essence I need to set the print area for whatever amount of data in columns A to E plus 10 blank rows at the end.

Hope that makes sense.

Thanks
Bob

Excel Workbook
ABCDE
1Last NameFirst NameDate Paid
2AetonRon30-Jun-17
3AlbertVicki04-May-17
4AlgesterLesley12-Jul-17
5BloggsBob27-Jun-17
6BrownGlen05-Jul-17
7CruiseAmanda05-Jul-17
8DevlonRobert07-Feb-18
9FastonMick27-Jun-17
10GothicBob05-Apr-17
11HarrietBeverly02-Aug-17
12
13
14
15
16
17
18
19
20
21
Sheet1
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Code:
With Range([A1], ActiveSheet.UsedRange)
ActiveSheet.PageSetup.PrintArea = .Resize(.Rows.Count + 10).Address
End With
 
Upvote 0
Hi footoo,

Thanks very much for your reply. Excuse my ignorance but it seems to me that if I add borders to the blank rows below my data as shown in my example above then your macro sets the print area to 10 rows below where my formatting finishes. Is that correct? Also I don't want to include row 1 in the print area as I want this row of titles to repeat on each page. In essence my worksheet is set up with borders, fonts and row heights for many rows below my data. What I want to do is to set the print area for A2:E? for the data plus 10 rows below. Is this possible?

Not sure if this makes sense but hopefully you can help.

Regards,

Bob
 
Upvote 0
Assuming column B can be used to find the last data row :
Code:
ActiveSheet.PageSetup.PrintArea = Range([A2], Cells(Cells(Rows.Count, "B").End(xlUp).Row + 10, "E")).Address
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

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