MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Set a print range with a macro

Posted by Charlie on October 24, 2001 9:01 AM

Each morning I download a file. I have a macro that is set up to run some calculations and formats, what I need to know is if it is possible to include a print range into this macro. Some days this file could be 8000 rows long and the next day it might be 3000 rows long. How can I set this macro up so that it will go to the bottom of the file each day to set the print range?

Posted by Juan Pablo on October 24, 2001 9:06 AM

If you're working on Sheet1, columns A through E, this should work.

Sheets("Sheet1").PageSetup.PrintArea = "$A$1:$E$" & Sheets("Sheet1").Range("A65536").End(xlUp).Row

Hope that works

Juan Pablo