ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   cell reference in header (https://www.excelbanter.com/excel-discussion-misc-queries/117570-cell-reference-header.html)

Dana

cell reference in header
 
How can I put a value of a cell into the header?

Barb Reinhardt

cell reference in header
 
As I recall, I had to Macro to do this.

Try this:

Alt F11
Double click on THIS WORKBOOK.
Click on GENERAL and pull down to WORKBOOK.
On the right it shows OPEN. Change it to BeforePrint
Let's say you want what's in cell A1 to be displayed.
Enter this in for the macro

Private Sub Workbook_BeforePrint(Cancel As Boolean)

With ActiveSheet.PageSetup
.RightFooter = ""
.LeftFooter = ""
.CenterFooter = ""
.RightHeader = ""
.LeftHeader = ""
.CenterHeader = Range("A1").Value
End With

End Sub


"Dana" wrote:

How can I put a value of a cell into the header?


mickey

cell reference in header
 
Can it include more than 1 cell?

"Barb Reinhardt" wrote:

As I recall, I had to Macro to do this.

Try this:

Alt F11
Double click on THIS WORKBOOK.
Click on GENERAL and pull down to WORKBOOK.
On the right it shows OPEN. Change it to BeforePrint
Let's say you want what's in cell A1 to be displayed.
Enter this in for the macro

Private Sub Workbook_BeforePrint(Cancel As Boolean)

With ActiveSheet.PageSetup
.RightFooter = ""
.LeftFooter = ""
.CenterFooter = ""
.RightHeader = ""
.LeftHeader = ""
.CenterHeader = Range("A1").Value
End With

End Sub


"Dana" wrote:

How can I put a value of a cell into the header?


Dave Peterson

cell reference in header
 
..CenterHeader = Range("A1").Value
could be

..CenterHeader = Range("A1").Value & vblf & range("b1".value & _
" " & format(range("c1").value, "mm/dd/yyyy")



Mickey wrote:

Can it include more than 1 cell?

"Barb Reinhardt" wrote:

As I recall, I had to Macro to do this.

Try this:

Alt F11
Double click on THIS WORKBOOK.
Click on GENERAL and pull down to WORKBOOK.
On the right it shows OPEN. Change it to BeforePrint
Let's say you want what's in cell A1 to be displayed.
Enter this in for the macro

Private Sub Workbook_BeforePrint(Cancel As Boolean)

With ActiveSheet.PageSetup
.RightFooter = ""
.LeftFooter = ""
.CenterFooter = ""
.RightHeader = ""
.LeftHeader = ""
.CenterHeader = Range("A1").Value
End With

End Sub


"Dana" wrote:

How can I put a value of a cell into the header?


--

Dave Peterson


All times are GMT +1. The time now is 07:51 PM.

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