To get the last row, you can use the "UsedRange" method:
dim lastrow as long
lastrow = worksheets("Sheet1").UsedRange.rows(worksheets("Sheet1").UsedRange.rows.count)
Note, though, that UsedRange will include any formatted cells, whether or not they contain data. Therefore, I usually use a different method instead. Assuming Column A has values in every row or your table, you can do this:
dim lastrow as long
lastrow = worksheets("Sheet1").range("A1048576").End(xlUp).row
Now that you know the last row, you can set your range like this:
dim rng as range
set rng = Worksheets("Sheet1").Range("A1:L"& lastrow)
Worksheets("Sheet1").pagesetup.PrintArea = rng
Just replace "Sheet1" with the appropriate name for your sheet.
Bookmarks