✔ 最佳答案
請服用
Sub ReversiblePrint()
Dim AP As Long
Dim SP As Long
Dim OP As Long
Dim EP As Long
With ActiveSheet
HP = .HPageBreaks.Count + 1
VP = .VPageBreaks.Count + 1
AP = HP * VP
SP = CLng(InputBox("請輸入你想開始列印的頁碼" & vbLf & "總頁數為 " & AP, , "1"))
OP = CLng(InputBox("請輸入結束列印的頁碼" & vbLf & "總頁數為 " & AP, , AP))
If MsgBox("開始頁碼為 " & SP & vbLf & "結束頁碼為 " & OP & vbLf & "如果要列印請按下確定" & vbLf & "如果不要列印請按取消", vbYesNo) = vbNo Then End
If SP > OP Or SP < 1 Or OP < 1 Or AP < 1 Then
MsgBox "輸入頁碼錯誤", vbCritical
End
End If
EP = CLng(SP) + 1
For SP = SP To AP Step 2
If SP > AP Or SP > OP Then Exit For
.PrintOut from:=SP, To:=SP
Next SP
If MsgBox("請更換為紙張背面" & vbLf & "如果要繼續列印請按下確定" & vbLf & "如果不要列印請按取消", vbYesNo) = vbNo Then End
For EP = EP To AP Step 2
If EP > AP Or EP > OP Then Exit For
.PrintOut from:=EP, To:=EP
Next EP
MsgBox "列印結束", vbInformation
End With
End Sub