Cell values in custom headers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I make a cell value appear in the custom header. I want a date in the
worksheet field A2 to appear in the header. I've tried several ways and cant
get it to appear. Any suggestions would be greatly appreciated!
 
Have you tried to concatenate() or & the value of your date field in the
header

="HEADER TEXT1"&A2
or = CONCATENATE("HEADER TEXT1",A2)
 
Must be done programatically via VBA.

Sub CellInHeader()
With ActiveSheet
.PageSetup.CenterHeader = .Range("A1").Value
End With
End Sub

Or use a BeforePrint rountine.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet
.PageSetup.CenterHeader = .Range("A1").Value
End With
End Sub

First macro goes into a General module.

Second goes into the Thisworkbook module.


Gord Dibben MS Excel MVP
 

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.

Ask a Question

Back
Top