Excel VBA - Printarea Selected Cells

  • Thread starter Thread starter jordanctc
  • Start date Start date
J

jordanctc

Here's a snip of my code. In the first three lines I'm selecting all o
the cells on the sheet. I can't get the part after Trial and Error t
work. I'm looking to Set Print Area for what I just selected. I mad
it work for borders but nothing remote similar has worked for this...

' Boarders - Gridlines, Outside Border, Last Row Border, Top Ro
Border

Range("U65536").End(xlUp).Select
Range(Selection, "A1").Select
Range("A1").Activate

' Trial and Error


ActiveSheet.PageSetup.PrintArea = Range(Selection).Select

Thanks,
Jorda
 
Try

ActiveSheet.PageSetup.PrintArea = _
Range("A1:U" & Range("U65536").End(xlUp).Row).Address
 
The PrintArea property expects a string value, so try

ActiveSheet.PageSetup.PrintArea = Range(Selection).Address
 

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