ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to create a "Field-like" Header? (https://www.excelbanter.com/excel-discussion-misc-queries/99639-how-create-field-like-header.html)

Ed

How to create a "Field-like" Header?
 
Hi, Is it possible to set up a Header in which I can have something like a
"Field" that get's its data from some part of the worksheet, maybe with some
sort of Lookup or something?



Dave Peterson

How to create a "Field-like" Header?
 
You could use a macro to retrieve a value right before you print/print preview.

This goes behind the ThisWorkbook module:

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Worksheets("sheet1").PageSetup
.LeftHeader = "a little stuff"
.CenterHeader = "what you want here"
.RightHeader = .range("a99").text
End With
End Sub

You can read more about events at:
Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm

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


Ed wrote:

Hi, Is it possible to set up a Header in which I can have something like a
"Field" that get's its data from some part of the worksheet, maybe with some
sort of Lookup or something?


--

Dave Peterson

Ed

How to create a "Field-like" Header?
 
Thank you very much!

"Dave Peterson" wrote:

You could use a macro to retrieve a value right before you print/print preview.

This goes behind the ThisWorkbook module:

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Worksheets("sheet1").PageSetup
.LeftHeader = "a little stuff"
.CenterHeader = "what you want here"
.RightHeader = .range("a99").text
End With
End Sub

You can read more about events at:
Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm

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


Ed wrote:

Hi, Is it possible to set up a Header in which I can have something like a
"Field" that get's its data from some part of the worksheet, maybe with some
sort of Lookup or something?


--

Dave Peterson



All times are GMT +1. The time now is 12:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com