deborahleah
New Member
- Joined
- Jul 10, 2008
- Messages
- 13
is there a macro code that will autmatically determine the end of your page and adjust your page breaks accordingly?
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim ws As Worksheet, LR As Long
For Each ws In ActiveWindow.SelectedSheets
LR = ws.Range("A" & Rows.Count).End(xlUp).Row
ws.PageSetup.PrintArea = ws.Range("A1:Z" & LR).Address
Next ws
End Sub
Sub RowPageSetUp()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
LR = ws.Range("A" & Rows.Count).End(xlUp).Row
ws.PageSetUp.PrintTitleRows = "$1:$8"
ws.PageSetUp.PrintArea = ws.Range("A1:Z" & LR).Address
With ws.PageSetUp
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = 500 ' or whatever?
End With
On Error Resume Next
Next ws
End Sub