Print Area

Claire Jackson

Board Regular
Joined
Jun 30, 2020
Messages
76
Office Version
  1. 2016
Platform
  1. Windows
HELP!

I need a simple macro to print an area of a worksheet which always starts at CELL "F5" and all the way to across to column "Z" but the length of the data will change as it's a pivot table, so print area could be F5..Z12 or could be F5..Z37 etc. etc.

It's not just the pivot table I'm printing, I have some formulas to the right too that are in the area that needs printing (columns J-Z)

If anyone can help that'd be great :)
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Try this:
VBA Code:
Sub MySetPrintArea()
    
'   Find last row in column Z with data
    Dim lrow As Long
    lrow = Cells(Rows.Count, "Z").End(xlUp).Row
    
'   Set print area
    ActiveSheet.PageSetup.PrintArea = "$A$2:$Z$" & lrow
    
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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