MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Print Area property not working


Posted by Melanie Swarner on October 30, 2001 12:56 PM

I'm trying to use PageSetup.PrintArea to set the print area for a worksheet. Here's my code:

Sheets("Exception Report").Activate
FinalRow = Range("E65536").End(xlUp).Row
FinalColumn = Range("IV4").End(xlToLeft).Column
Set PrintRange = Range(Cells(3, 3), Cells(FinalRow, FinalColumn))
With ActiveSheet.PageSetup
.PrintArea = PrintRange
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With

I don't get any errors, but when I Print Preview, it still shows me the first two columns (which I'm trying to exclude). If I tell it to select Range(Cells(3, 3), Cells(FinalRow, FinalColumn)) it selects the area I'm trying to get, so I know that part is right. I don't understand why it doesn't work.

Thanks!

Melanie


Posted by Johnny Giles on October 30, 2001 2:28 PM


The PrintRange needs to be a String, not a Range :-

PrintRange = Range(Cells(3, 3), Cells(FinalRow, FinalColumn)).Address


Posted by Melanie Swarner on October 31, 2001 4:38 AM

Thanks! (nt)