View Full Version : Solved: Setting the print area for used rows and columns

11-22-2007, 12:57 AM
Hey once again all,

Just encountered yet another problem.
Im runing a macro where i want to set the printing area as all the used columns "A:L" and the rows "9:[lastrow]".

My code is like this:
Dim y As Long, lastCell2 As range
y = ActiveSheet.UsedRange.Rows.Count
Set lastCell2 = Cells.SpecialCells(xlCellTypeLastCell)
ActiveSheet.PageSetup.PrintArea = range(Cells(9, 1), lastCell2).Address

but Im guessing that im missing the point here ...
Anyone can help?!

Bob Phillips
11-22-2007, 01:03 AM
Works fine for me. What is happening?

11-22-2007, 01:10 AM
for me its marking all rows instead of stopping at the last one ...
maybe its my sheet...

Bob Phillips
11-22-2007, 01:22 AM
Yeah, try this out


11-22-2007, 01:41 AM
exactly - thnx!!