Referring to Cell in Header

T

Tami

can i refer to a cell in a header...for example if cell A1 says July Week
1...then it could say that in the header?
 
D

Dave Peterson

You could use a macro that runs each time you print or print preview.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Wks As Worksheet
Set Wks = Me.Worksheets("Sheet1")
With Wks
.PageSetup.CenterHeader = .Range("A1").Value
End With
End Sub


If you're new to macros:

Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)
 
T

Tami

so how do i run the macro or have it automatically run when i print?
i'm used to making macro buttons and assignin a macro or going to
tools/macros/run ....
 
D

Dave Peterson

Look at Debra's site for the ThisWorkbook module stuff.

As long as macros are enabled and you haven't disable events, then this will run
each time you print/print preview that workbook.
 
Top