Please help with passing values
hi, try this:
Sub PrintSchedule()
'This procedure executes when the user clicks the Print Schedule
button and print
'previews all the expense schedule.
Dim PrintThis As Range
'Dim sh As Worksheet
frmWait.Show 0
frmWait.Repaint
Worksheets("Expense Schedule").Activate
'Application.ScreenUpdating = False
'Application.ScreenUpdating = True
'PrintThis = ActiveSheet.Range("A20:P" &
LastRowRange(ActiveSheet)).Address
Set PrintThis = ActiveSheet.Range("A20:P" & LastRowRange(ActiveSheet))
'<
frmWait.Hide
With Worksheets("Expense Schedule").PageSetup
If .TopMargin < Application.InchesToPoints(0.5) Then
.TopMargin = Application.InchesToPoints(0.5)
End If
.PrintTitleRows = Worksheets("Expense
Schedule").Range("A20:A21").Address
..PrintArea = PrintThis.Address '<
.Orientation = xlLandscape
.CenterHeader = ""
.BlackAndWhite = True
If .CenterHeader < "" Then .CenterHeader = ""
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 100
End With
Worksheets("Expense Schedule").PrintPreview
Worksheets("Help").Activate
Worksheets("Inv Summ").Activate
Range("A1").Select
End Sub
'Function LastRowRange(sh As Worksheet)
Function LastRowRange(sh As Worksheet) As Long '<
'This function determines the active print
'range for a list and returns a range object.
'On Error Resume Next
' LastRowRange = sh.Range("A:P").Find(What:="*", _
After:=sh.Range("A21"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False) .Row
LastRowRange =
Range("P20").CurrentRegion.SpecialCells(xlCellType LastCell).Row
'On Error GoTo 0
End Function
Regards,
ste
|