Passing Data to Headers / Footers

  • Thread starter Thread starter Randy Numbers
  • Start date Start date
R

Randy Numbers

Greetings All,

I want to include a version number in the headers printed with my sheets. Is
there a way to point to a cell within the header setup? I see how to insert
standard stuff (file names, page nums, etc.). Is there syntax to include a
cell? Thanks../Randy
 
Randy,

By version number, I think you mean your own workbook version number (I use
them a lot). Maybe you could include it in the "row(s) to include at top"
instead of the Custom Header.
 
Hi Randy

With code it is possible

You can copy this in the Thisworkbook module
Every time you print it will add the cell to the Footer

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In ThisWorkbook.Worksheets
wkSht.PageSetup.RightFooter = "&8Version number : " & _
ThisWorkbook.Sheets("Sheet1").Range("A1").Value
Next wkSht
End Sub
 
Ron,

Thanks for you help.. follow-on question: I would also like to show the file
name -- hw can I incorporate as a second line?
 
Hi Randy

You can use vbNewLine

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In ThisWorkbook.Worksheets
wkSht.PageSetup.RightFooter = "&8Version number : " & _
ThisWorkbook.Sheets("Sheet1").Range("A1").Value & vbNewLine & _
UCase(ActiveWorkbook.FullName)
Next wkSht
End Sub
 
Back
Top