Results 1 to 4 of 4
  1. #1
    4 Star Lounger pauliez's Avatar
    Join Date
    Dec 2003
    Location
    Connecticut, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need Macro for Excel (Excel)

    I am setting up a mass of Excel documents, about 2,500 pages, which will have text on both sides of each page when printed. It is easy for me to permanently set the page number in the center, right or left of each page to have uniformity, but what I would like to do is have the page number in the upper right hand corner for odd numbered pages and the page number in the upper left hand corner of the even numbered pages. Is there a way to do this automatically with Excel page set-up or do I need a special formula? If so where can I get it. Please reply.
    Catz

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Need Macro for Excel (Excel)

    You haven't specified the version of Excel you're using.

    In Excel 2007 you can specify that dd and even pages should have different headers/footers. This feature is not available in earlier versions of Excel.

  3. #3
    4 Star Lounger pauliez's Avatar
    Join Date
    Dec 2003
    Location
    Connecticut, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need Macro for Excel (Excel)

    The version I am using is 2000. Guess its time to catch up. <img src=/S/groan.gif border=0 alt=groan width=16 height=15>
    Catz

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Need Macro for Excel (Excel)

    You might try this macro in Excel 2000, but it will be slow, since it prints each page as a separate print job.
    The odd pages will be printed first, you'll be prompted to place the printed pages in the input tray again, and then the even pages will be printed.
    I'd experiment with a small sample first, you may have to reverse the print order depending on how your printer arranges the ouptput.
    <code>
    Sub PrintDifferentOddEven()
    Dim wsh As Worksheet
    Dim intHBreaks As Integer
    Dim intVBreaks As Integer
    Dim intPages As Integer
    Dim intPage As Integer

    Set wsh = ActiveSheet
    intHBreaks = wsh.HPageBreaks.Count + 1
    intVBreaks = wsh.VPageBreaks.Count + 1
    intPages = intHBreaks * intVBreaks

    For intPage = 1 To intPages Step 2
    With wsh.PageSetup
    .LeftHeader = ""
    .RightHeader = "&P"
    End With
    wsh.PrintOut From:=intPage, To:=intPage
    Next intPage

    MsgBox "Please place the printed pages in the input tray" & vbCrLf & _
    "so that the reverse side can be printed.", vbExclamation

    For intPage = 2 To intPages Step 2
    With wsh.PageSetup
    .LeftHeader = "&P"
    .RightHeader = ""
    End With
    wsh.PrintOut From:=intPage, To:=intPage
    Next intPage
    End Sub</code>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •