Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to set the print area in a macro. I have varying lines of data
and the last column of data does not contain the last row of data. In the code below, which I copied in a previous post from Ivan Raiminius, how do I add 3 rows to my range so that the print area will include all my data? Sub PrintArea() ' ' PrintArea Macro ' Macro recorded 11/20/2008 by Network Administrator ' ' Dim i As Long Dim j As Long Dim rng As Range Set rng = Range("a1..n1") ' the address of first row of data you want to Print out j = 0 For i = 1 To rng.Columns.Count j = WorksheetFunction.Max(j, rng.Cells(Application.Rows.Count - rng.Row, 1).End(xlUp).Row) Next i ActiveSheet.PageSetup.PrintArea = rng.Resize(j - rng.Row + 1, rng.Columns.Count).Address End Sub Thanks so much for your help.. -- www.bardpv.com Tempe, Arizona |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel, worksheet, set print area, position selection on printed pa | New Users to Excel | |||
How do I clear a print area when the selection is grayed out? | Excel Discussion (Misc queries) | |||
print area selection slows excel, formula for hiding rows?? | Excel Discussion (Misc queries) | |||
set print area based on selection | Excel Programming | |||
set print area based on selection | Excel Programming |