Efficient printing
Hi Robert,
Am Wed, 12 Nov 2014 13:15:28 -0700 schrieb Robert Crandal:
Users can only enter data into the following ranges:
A5:N20, A30:N50, A60:N80, and A90:N100.
then try:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim i As Long, Counter As Long
Dim strRng As String
Dim varRng As Variant
strRng = "A5:N20,A30:N50,A60:N80,A90:N100"
varRng = Split(strRng, ",")
With ActiveSheet
If .Name < "Sheet1" Then Exit Sub
With .PageSetup
.Orientation = xlLandscape
.PrintArea = "$A$1:$N$110"
End With
For i = LBound(varRng) To UBound(varRng)
If WorksheetFunction.CountA(.Range(varRng(i))) 0 Then
Counter = Counter + 1
Else
Exit For
End If
Next
.PrintOut from:=1, to:=Counter
End With
End Sub
Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
|