Microsoft Office Tutorials and References
In Depth Information
Printing the Contents of a Cell in a Header or Footer
Printing the Contents of a Cell
in a Header or Footer
The Excel Header and Footer options are fairly flexible, but you have no direct way to display the
contents of a cell in a page header or footer. The solution is a simple VBA macro.
Figure 191-1 shows a worksheet with some values. Cell A1 contains a simple formula that
calculates the sum of the values. The goal is to display the value in cell A1 in the center header of the
page.
Figure 191-1: A simple VBA macro displays the contents of cell A1 in the page header.
To create the macro, follow these steps:
1. Make sure that the workbook’s window isn’t maximized.
2. Right-click the workbook window’s title bar and choose View Code.
The (empty) code module for the ThisWorkbook object is displayed in the Visual Basic
Editor.
 
Search JabSto ::




Custom Search