First put the desired formulas into cells, say A1, A2, A3. Then put the
following macro in the workbook code area:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
Application.ScreenUpdating = False
With ActiveSheet.PageSetup
.LeftHeader = Range("A1").Value
.CenterHeader = Range("A2").Value
.RightHeader = Range("A3").Value
End With
Application.ScreenUpdating = True
End If
End Sub
Whenever the sheet is printed, the values of cells A1, A2, and A3 will
appear ing the header.
Gary,
Many thanks but not quite what I wanted.
Doing it that way I would Have to put a macro for every sheet (lots) and
reference each sheet name.
I would have like to have done something simple like "=Sheet1!A1" in the
custom header box but it appears to simple for Excel.
My research into this gave me answers like yours but not entirely what I
need.
Thanks for your efforts
Many thanks again
John
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.