Multiple Line Headers and Footers

Written by Allen Wyatt (last updated August 6, 2022)
This tip applies to Excel 97, 2000, 2002, and 2003


If you use a macro code to set your header or footer, you can designate more than one line for them. Thus, you could have a two or three line header or footer, if desired. You do this by simply including the code Chr(13) into the string you use to set the header or footer. When used with the command codes discussed in other issues of ExcelTips, this is very powerful, indeed.

For instance, let's say you wanted a centered header that included your company name on the first line with today's date on the second. You would use the following code:

ActiveSheet.PageSetup.CenterHeader = "&C&BAmalgamated Widgets, Inc.&B"
& Chr(13) & "&D"

Note the use of the &B command code to make the company name bold. The second use of the command code is to turn the bold attribute off, so that the date does not end up being bold. Also, note the use of the &C command code. Remember that the use of positioning command codes such as these overrides placement. Thus, the following code (which would normally place the information at the left side of the header) has the exact same results as the previous code:

ActiveSheet.PageSetup.LeftHeader = "&C&BAmalgamated Widgets, Inc.&B"
& Chr(13) & "&D"

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (1992) applies to Microsoft Excel 97, 2000, 2002, and 2003.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Using MPF Graphic Files

There are all sorts of file formats used to store graphics. You might think that one of those formats is the MPF format, ...

Discover More

Splitting Table Cells

When formatting tables, you can both merge and split cells. Here's a couple of ways you can easily perform the latter ...

Discover More

Limiting Document Page Count

Do you need to have your document fit within a certain number of pages? This can be close to impossible to do within ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (menu)

Deleting a Footer

Excel allows you to add footers to the worksheets you create. If you decide you don't need a footer any more, here's how ...

Discover More

Selective Headers and Footers

Want to print different headers or footers on different parts of your worksheet? Excel has no inherent way to do this, ...

Discover More

Leading Zeros in Page Numbers

Page numbers in Excel printouts are typically simple counters, without much chance for embellishment. If you want to add ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 - 5?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.