ExcelBanter

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

John in Surrey

view cell content in header
 

Hi folks
Can I customise the header so the left section = the content of a cell
in the sheet eg A1.
All I seem to be able to do is add date, page etc etc..
thanks
john
Images of home (NZ)
http://www.titahi-bay.co.nz/home
What we are up to in the UK
http://www.titahi-bay.co.nz

Dave Peterson

view cell content in header
 
You need some VBA code to do this:

You can use the workbook_beforeprint event to modify the header.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Me.Worksheets("sheet1")
.PageSetup.LeftHeader = .Range("a1").Text
End With
End Sub

This goes behind the ThisWorkbook module.

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

John in Surrey wrote:

Hi folks
Can I customise the header so the left section = the content of a cell
in the sheet eg A1.
All I seem to be able to do is add date, page etc etc..
thanks
john
Images of home (NZ)
http://www.titahi-bay.co.nz/home
What we are up to in the UK
http://www.titahi-bay.co.nz


--

Dave Peterson


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

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