ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel header/footer cell reference (https://www.excelbanter.com/excel-discussion-misc-queries/60718-excel-header-footer-cell-reference.html)

Paddy

Excel header/footer cell reference
 
In Excel is it possible to put a cell referenc in a header or footer?

Gord Dibben

Excel header/footer cell reference
 
Paddy

With the use of VBA, yes.

Sub CellInFooter()
With ActiveSheet
.PageSetup.CenterFooter = .Range("A1").text
End With
End Sub


Gord Dibben Excel MVP

On Thu, 15 Dec 2005 21:08:03 -0800, "Paddy"
wrote:

In Excel is it possible to put a cell referenc in a header or footer?


Dave Peterson

Excel header/footer cell reference
 
Via code? Yes.

You can use the workbook_beforeprint event to modify the header.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Me.Worksheets("sheet1")
.PageSetup.CenterFooter = .Range("a1").Text
End With
End Sub

This goes behind the ThisWorkbook module.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm



Paddy wrote:

In Excel is it possible to put a cell referenc in a header or footer?


--

Dave Peterson


All times are GMT +1. The time now is 07:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com