Book

Suggestions


Enter your email address:

Delivered by FeedBurner


Home Page

Bloglines

1906
CelebrateStadium
2006


OfficeZealot

Scobleizer

TechRepublic

AskWoody

SpyJournal












Subscribe here
Add to 

My Yahoo!
This page is powered by Blogger. Isn't yours?

Host your Web site with PureHost!


eXTReMe Tracker
  Web http://www.klippert.com



  Saturday, June 06, 2015 – Permalink –

Formatting Code for Headers and Footers

Roll your own


From Microsoft support:

The following list contains the format codes that you can use in headers and footers.

Codes to format text ("&" is an ampersand - Shift+7)

&L



Left-aligns the characters that follow.



&C



Centers the characters that follow.



&R



Right-aligns the characters that follow.



&E



Turns double-underline printing on or off.



&X



Turns superscript printing on or off.



&Y



Turns subscript printing on or off.



&B



Turns bold printing on or off.



&I



Turns italic printing on or off.



&U



Turns underline printing on or off.



&S



Turns strikethrough printing on or off.



&"fontname"



Prints the characters that follow in the specified
(font. Be sure to include the quotation marks around the font name.)



&nn



Prints the characters that follow in the specified
(font size. Use a two-digit number to specify a size in points.)

Codes to insert specific data

&D
Prints the current date
&T
Prints the current time
&F
Prints the name of the document
&A
Prints the name of the workbook tab (the "sheet name")
&[File]
Also prints file name
&[Path]
Prints path
&[Picture]
Opens dialog box to select graphic (2003)
&P
Prints the page number
&P+number
Prints the page number plus number
&P-number
Prints the page number minus number
&&
Prints a single ampersand
&N
Prints the total number of pages in the document


In a macro, to use multiple lines in a header, use either of the following methods:
  • Use CHR(10) to insert a linefeed character.
  • Use CHR(13) to insert a carriage return character.
The article also includes the VBA to create a macro that will insert header/footer information:
Microsoft KB213618

Also: Daily Dose of Excel: Formatting Footers in VBA


See all Topics

Labels: , , , , , , ,


<Doug Klippert@ 3:42 AM

Comments: Post a Comment