Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Oct 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help, please, with VB Headers/Footers on certain pages only.

    What I want to do, I think, should be simple, but I'm not finding the answers, and experimenting is failing miserably.

    I have custom concatenated cells being pulled in using the following VBScript:

    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    ActiveSheet.PageSetup.CenterFooter = Range("'DB1'!b25").Text
    End Sub


    One of my sheets in this file is set up as my "printable material" sheet - i.e. all my other calcs come into this sheet with nice pretty charts and texts and it's awesome. Now iwth my custom Headers/footers, formatting is even nicer. BUT... But I want the custom scripting to not appear on the first two pages of this specific sheet. So, pages 1-2, not ok. pages 3 through 15, very ok.

    Anyone have any suggestions?

    Thanks!
    R2R

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    371
    Thanked 1,456 Times in 1,325 Posts
    R2R,

    Welcome to the Lounge as a new poster!

    I would recommend a custom print macro that would do 2 print commands.
    The first one would strip the headers/footers via vba then print pages 1-2.
    Then Re-institute the headers/footers and print pages 3-. HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,631
    Thanks
    115
    Thanked 645 Times in 589 Posts
    R2R,

    I think this should do it

    Code:
    Sub PrintFooters()
    '-----------------------------------------------
    'REMOVE FOOTER AND PRINT PAGES 1-2
        ActiveSheet.PageSetup.CenterFooter = ""
        ActiveSheet.PrintOut From:=1, To:=2
    '-----------------------------------------------
    'ADD FOOTER AND PRINT PAGES 3-15
        ActiveSheet.PageSetup.CenterFooter = Range("'DB1'!b25").Text
        ActiveSheet.PrintOut From:=3, To:=15
    '-----------------------------------------------
    'REMOVE FOOTER
        ActiveSheet.PageSetup.CenterFooter = ""
    End Sub

Posting Permissions

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