Add the data from a cell into the header

New Contributor

I would like to use the content of cell A1, for example, as the recurring data in the worksheet's header.  Can #Excel do this?

2 Replies




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:

  1. Hit ALT + F11 >> opens the visual Basic editor
  2. Right Clisk where it says "This Workbook"
  3. Above the white working area there are 2 drop lists
  4. Select "Workbook" from the Left Drop List
  5. Delete the 2 lines that appeared automatically
  6. 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.

Nabil Mourad

You'll learn how to link the page header to a specific cell with Excel VBA. The Excel macro is very simple. Best part is it runs automatically every time you...



Thank you for the information on the macro option.  I look forward to reviewing and using this option.