Headers based on Cell Values

  • Thread starter Thread starter kraljb
  • Start date Start date
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
 
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
 

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