+ Reply to Thread
Results 1 to 2 of 2

Printing Custom Header

  1. #1
    lfalgi
    Guest

    Printing Custom Header

    I would like to print information that is entered deep in the spreadsheet
    (i.e. A200, E205) as a header. I can't seem to find a way to define a range
    of cells as a custom header.
    --
    Larry Falgiani

  2. #2
    Dave Peterson
    Guest

    Re: Printing Custom Header

    You'll need a little macro.

    Record a macro when you change the header the way you want.

    Then instead of burying the value in the code, you can pick up the value from a
    cell on that sheet.

    My recorded code looked like:

    With ActiveSheet.PageSetup
    .LeftHeader = "asdfadsfasdf"
    .CenterHeader = ""
    .RightHeader = ""
    .LeftFooter = "&D &T"

    I changed it to:

    With Worksheets("sheet1").PageSetup
    .LeftHeader = .Parent.Range("a200").Value
    End With

    (I tossed all the things I didn't want to touch, too!)

    But now to make it update right before I hit the print button, the code has to
    be placed behind the ThisWorkbook module in the correct event procedure
    (_beforeprint).

    Option Explicit
    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    With Worksheets("sheet1").PageSetup
    .LeftHeader = .Parent.Range("a200").Value
    End With
    End Sub

    If you're new to macros, you may want to read David McRitchie's intro at:
    http://www.mvps.org/dmcritchie/excel/getstarted.htm


    lfalgi wrote:
    >
    > I would like to print information that is entered deep in the spreadsheet
    > (i.e. A200, E205) as a header. I can't seem to find a way to define a range
    > of cells as a custom header.
    > --
    > Larry Falgiani


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1