Hi,
Below is a snippet of code which I found in some Excel forum and I hav
used previously to determine the print range of a list.
For some reason this code does not seem to work anymore and it seems t
have something to do with the passing of arguments??
Any help would be REALLY appreciated!!
Code
-------------------
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
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
.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)
'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
On Error GoTo 0
End Functio
-------------------
--
Frigid_Digi
-----------------------------------------------------------------------
Frigid_Digit's Profile:
http://www.excelforum.com/member.php...fo&userid=2692
View this thread:
http://www.excelforum.com/showthread.php?threadid=46782