Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
lfalgi
 
Posts: n/a
Default 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   Report Post  
Dave Peterson
 
Posts: n/a
Default

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
header or footer ParTeeGolfer Excel Worksheet Functions 4 January 9th 05 07:33 PM
Printing the page properties as header r_najafi Excel Discussion (Misc queries) 1 January 6th 05 02:59 PM
how do I permanetly add custom header to excel header list? GARY Excel Discussion (Misc queries) 1 December 15th 04 08:52 PM
Default header in Excel under page set-up Melanie Excel Discussion (Misc queries) 2 December 15th 04 01:37 AM
Custom Header Josh O. Excel Discussion (Misc queries) 1 December 1st 04 06:56 PM


All times are GMT +1. The time now is 08:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"