Sub PrintActivePage()
Sub PrintActivePage()
Dim wks As Worksheet
Set wks = ActiveSheet
Dim i As Integer, x As Integer, y As Integer, n As Integer
For i = 1 To wks.HPageBreaks.Count
If wks.HPageBreaks(i).Location.Row > ActiveCell.Row Then
y = i
Exit For
End If
Next i
If y = 0 Then y = wks.HPageBreaks.Count + 1
For i = 1 To wks.VPageBreaks.Count
If wks.VPageBreaks(i).Location.Column > ActiveCell.Column Then
x = i
Exit For
End If
Next i
If x = 0 Then x = wks.VPageBreaks.Count + 1
If wks.PageSetup.Order = xlDownThenOver Then
n = (x - 1) * (wks.HPageBreaks.Count + 1) + y
Else
n = (y - 1) * (wks.VPageBreaks.Count + 1) + x
End If
wks.PrintOut n, n
End Sub |