Headers and footers

J

Jack Schitt

Hi all

How do you enter a formula into a header or footer?
Even one as simple as "=CellRef" to return the value in the Cell referenced
would be a help
 
J

JE McGimpsey

Instead of entering the formula in the header/footer, use an event macrl:

Put something like this in the ThisWorkbook code module:


Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wsSheet As Worksheet
For Each wsSheet In ActiveWindow.SelectedSheets
With wsSheet
If .Name = "Sheet1" Then _
.PageSetup.CenterFooter = .Range("A1").Text
End With
Next wsSheet
End Sub

Modify the sheet name and range reference to suit.

If you're unfamiliar with macros, see David McRitchie's "Getting Started
with Macros":

http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
Top