Headers based on Cell Values

K

kraljb

I would like to have my header variable based upon the value of certai
cells.
If there is a way to do this without VBA, that would be the best way
However, if it is only in VBA, then that is what I will have to do
 
F

Frank Kabel

Hi
not possible without VBA. You have to use the BeforePrint event of your
workbook. So try putting the following type of code in your workbook
module 'ThisWorkbook' (don't put it in a standard module):
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In Me.Worksheets
With wkSht.PageSetup
.CenterHeader = wkSht.range("A1").value
End With
Next wkSht
End Sub



This code inserts the value of cell A1 in each worksheet's center
header
 
Top