link to cell in header or footer

R

Robert Ehrlich

what I like to do in Excel:

- in any register for ex. "Register" I have included in cell "A1" text like
"project ABC"
- this text should be present in the header on top of the page when I print
out
- so I'm be able to change the header depends on the text in the cell

I'm looking for any possibility to include this "=Register!A1" in the header

Any idea?
How can help?


Robert
 
G

Gary''s Student

If you put this small macro in worksheet code:


Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Range("A1"), Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
ActiveSheet.PageSetup.CenterHeader = Range("A1").Value
Application.EnableEvents = True
End Sub

It will automatically detect changes to cell A1 and put the contents in the
header.
 
J

JB

Modify header with Cell:

If A1 contains formula, there is no change for A1. Use event
Before_Print

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
ActiveSheet.PageSetup.CenterHeader = Sheets("Feuil1").Range("A1")
End If
End Sub

http://cjoint.com/?fuqCncpEoK

Cordialy JB
 
Top