PDA

View Full Version : Solved: Set Print Area - Last Row/Cell Used



SDave
09-21-2009, 02:59 AM
Does anyone happen to know of, or have a vba code which sets the print area of a sheet to the last row (preferably cell) used, excluding formulas and conditional formatting?

I have formulas running down both columns M and Q, conditional formatting in column N, not to mention validation lists in columns H, I, J, N, O, P, and V.

I had strung together the following code but it doesn't seem to work in the way that I had hoped:


Sub PepPrint()
Application.ScreenUpdating = False
Sheets("People_Data").PageSetup.PrintArea = Range("C2", Range("U1000").End(xlUp)).Address
Application.ScreenUpdating = True
End Sub


It only sets the print area up until my column headers - row 11.

Any help would be much appreciated.

Thanks.

Bob Phillips
09-21-2009, 03:55 AM
Why not just used UsedRange?

SDave
09-21-2009, 04:42 AM
Thanks xld - much appreciated.