ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I set up a Custom Header that references a specific cell (https://www.excelbanter.com/excel-discussion-misc-queries/93714-how-do-i-set-up-custom-header-references-specific-cell.html)

Norm

How do I set up a Custom Header that references a specific cell
 
When printing in excel, I need to create a custom header that will reference
a specific cell on a specific sheet. In this case it would contain a date
(different from today's date) to be printed on the spreadsheet. specifically
" production ending "wk1:a1""

so that it would then print: production ending 6/5/06

thanks


Norm

Bob Phillips

How do I set up a Custom Header that references a specific cell
 
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftHeader = "production ending " & _
Format(Worksheets("wk1").Range("A1").Value, "m/d/yy")
End With
End Sub

This is workbook event code.
To input this code, right click on the Excel icon on the worksheet
(or next to the File menu if you maximise your workbooks),
select View Code from the menu, and paste the code

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Norm" wrote in message
...
When printing in excel, I need to create a custom header that will

reference
a specific cell on a specific sheet. In this case it would contain a date
(different from today's date) to be printed on the spreadsheet.

specifically
" production ending "wk1:a1""

so that it would then print: production ending 6/5/06

thanks


Norm





All times are GMT +1. The time now is 05:38 PM.

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