Automatically Sizing PrintArea

  • Thread starter Thread starter ob3ron02
  • Start date Start date
O

ob3ron02

I was wondering if anyone could suggest a method to dynamically set
PrintArea on a worksheet according to the last used row (the # o
colums will always be constant).

I know to use -Sheet1-.PageSetup.PrintArea = "-A1:F15-" but i can'
figure out how to find the last row with data in it and get th
appropriate range from that last row.

Thanks,

To
 
If you don't set any printarea, it should do what you want.

but,
Last non-empty cell in column A

Dim rng as Range
set rng = Cells(rows.count,1).end(xlup)
' assume 10 columns wide
set rng = Range(Range("A1"), rng).Resize(,10)

Activesheet.PageSetup.PrintArea = rng.Address(external:=True)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top