Print Range Macro

J

Jeff

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.
 
T

Tom Ogilvy

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)
 
Top