ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print Range Macro (https://www.excelbanter.com/excel-programming/301500-print-range-macro.html)

jeff

Print Range Macro
 
I need a macro that will automatically find the row with
the last entry and set the print range to that row and
then print. Assuming columns A through D will contain
data, what would the VBA code look like? Thanks.

Tom Ogilvy

Print Range Macro
 
if you remove the Print_Area definition in the Names, then printing the
sheet should do what you want.

otherwise

Dim rng as Range
set rng = Cells(rows.count,1).end(xlup)
Activesheet.PageSetup.Printarea = _
range("A1",rng.offset(0,3)).Address(external:=True )

--
Regards,
Tom Ogilvy


"Jeff" wrote in message
...
I need a macro that will automatically find the row with
the last entry and set the print range to that row and
then print. Assuming columns A through D will contain
data, what would the VBA code look like? Thanks.





All times are GMT +1. The time now is 05:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com