07-22-2019 07:36 AM
07-22-2019 09:19 AM - edited 07-22-2019 09:39 AM
You cannot reference a cell in the Header section (Say by typing =C5) that will not grab the value. However there is a tricky way to resolve this issue by recording a simple Macro and trigger it before printing.
Here is a Tutorial that covers exactly that issue:
if you do not want to watch the Tutorial then do the following:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Sh As Worksheet
For Each Sh In Me.Worksheets
Sh.PageSetup.CenterHeader = Sh.Range("C5").Value
You can replace CenterHeader by LeftHeader or RightHeader
replace C5 by any cell of your choice
On the Other hand , in the Page Setup dialog box (Shortcut is ALT, P, S, P) >> Header Tab >> Custom Header >> You have some icons to include predefined functionality such as Date, Time, File Name, Sheet Nam ...etc
Hope that helps you
If you like my answer please mark it as an accepted one.