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:
Hit ALT + F11 >> opens the visual Basic editor
Right Clisk where it says "This Workbook"
Above the white working area there are 2 drop lists
Select "Workbook" from the Left Drop List
Delete the 2 lines that appeared automatically
Copy & Paste this code:
Private Sub Workbook_BeforePrint(Cancel As Boolean) Dim Sh As Worksheet For Each Sh In Me.Worksheets Sh.PageSetup.CenterHeader = Sh.Range("C5").Value Next Sh End Sub
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.