VBA to set dynamic print area

Joined
Jul 29, 2011
Messages
2
Reaction score
0
I have a worksheet that has info from column A to W and the amount of data varies. I need a VBA code that will set the print area to the last row of data. However, in rows L, M & N I have sum formulas that are one row down from the last row of data. So essentially, I need a code that will set the print area from A1 to the last line of W and then go down two additional rows to capture the sum formulas. I am pretty much a novice at VBA, so the simpler the better.

Thanks
Clint
 
Never mind. I figured it out. For anyone who may come accross this same issue the code is:

Sub SetArea()
ActiveSheet.PageSetup.PrintArea = Range("A1:W1", Range("N65536").End(xlUp)).Address
End Sub

Of course, you would have to change the range but you get the idea.
 
Back
Top