manac ham chơi

26 February, 2008

Print odd and even pages

Filed under: manac nói nhảm — manac @ 9:23 am

This option is not available in Excel but you can use a macro to do it.

Sub Print_Odd_Even()
    Dim Totalpages As Long
    Dim StartPage As Long
    Dim Page As Integer

    StartPage = 1  '1 = Odd and 2 = Even

    'Or use the InputBox suggestion from Gord Dibben
    'StartPage = InputBox("Enter 1 for Odd, 2 for Even")

    Totalpages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
    For Page = StartPage To Totalpages Step 2
        ActiveSheet.PrintOut from:=Page, To:=Page, _
                             Copies:=1, Collate:=True
End Sub

Blog at