Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set the format of the CenterFooter with same-lenght number.

Status
Not open for further replies.

softlover

Programmer
Apr 4, 2002
88
CN
I want to set the format of the centerfooter from "Page 0001" to "Page xxxx" in EXCEL2000.
And I use the following codes.
With ActiveSheet.PageSetup
.CenterFooter = Right$("000" & "&P", 4)
End With
But the result is not good. Before ten pages the centerfooter were "00x" ("x" means "1" to "9"). From 10 to 99 pages the centerfooter were "00xx". But after 100 pages, the centerfooter were "00xxx".
Any one know the way to get the good result. Thanks in advance.
 

Hi,

Try Format
Code:
With ActiveSheet.PageSetup
     .CenterFooter = Format(&P, "0000")
End With
or if that doesn't work...
Code:
With ActiveSheet.PageSetup
     .CenterFooter = "&P"
     .CenterFooter = Format(.CenterFooter, "0000")
End With


Skip,

[glasses] [red]Be Advised![/red]
The band of elderly oriental musicians, known as Ground Cover, is, in reality...
Asian Jasmine![tongue]
 
Thanks to SkipVought. I had tried to use your codes But the codes can't achieve the expected result.
 


Print is one of those functional areas that Microsoft as not developed consistently with other areas.

Skip,

[glasses] [red]Be Advised![/red]
The band of elderly oriental musicians, known as Ground Cover, is, in reality...
Asian Jasmine![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top