Page numbers on odd pages only

  • Thread starter Thread starter Rene
  • Start date Start date
R

Rene

I have a spreadsheet where I only need to print the odd numbered pages (the
even pages are hidden back-up info), but I need them to be numbered 1, 2, 3,
etc instead of 1, 3, 5. Any suggestions?

Thanks!
 
Rene,

Probably a macro will be required. It will do each page as a separate print
job.

TotalPages = 10
For PageNumber = 1 To TotalPages Step 2
' (PageNumber will be 1 3 5, etc.)

' Set first page to PageNumber (first page is only page)
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 300
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = PageNumber ' This one we need
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With

' The following line prints page PageNumber:
ActiveWindow.SelectedSheets.PrintOut From:=PageNumber, To:=PageNumber,
Copies:=1, Collate _
:=True

You can remove all the junk in the With ActiveSheet.PageSetup clause if you
want to (like .LeftHeader = "", etc), except .FirstPageNumber = PageNumber.
Otherwise it will overwrite any page setup settings you've put in.

You can paste this from here directly into a module in the VBE. Fix any
broken lines that the email (a junky old teletypewrite) broke up. :)

This is untested. It will eventually fail when it tries to print a page
beyond TotalPages (maybe sooner!). We can probably fix that. See if it
works for you.

Earl Kiosterud
mvpearl omitthisword at verizon period net
so far no spam
 
If your "hidden back-up info" pages are actually hidden, the "odd"
pages will print out with sequential numbering.

Consider using Data/Group and Outline to group your "even" pages to
make hiding them easy. You could also record a macro to automate the
printing.
 
Rene,

Hmmm. J.E.'s answer has me wondering. If by hidden pages, you mean hidden
sheets (as you probably do), my solution isn't for you.
 
Back
Top