Leading zero in header with vba

wsaggia

New Member
Joined
Jan 28, 2019
Messages
3
Hi friends.
First I would like to congratulate Mr Excel for his 20 years old, by providing rich tips.
Here I come with this question: I need to add Leading zero in the page number header in a sheet with almost 300 page. ex. 00001, 00010, 00100, as you can see I need write some zero in front, so the format of page like starting at “00002”.
Probably I need a vba to approach.
I appreciated the help.

Thanks,
William
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi gruntingmonkey,

Do you know, how to adjust the reference code (vba) given by the link above, so apply only the format to all page "0000#" without print.
The code reference apply the format as expected, but sent the print by each page.

Thanks,
William
 
Upvote 0
You will have to amend the part where it says

Code:
 .PrintOut From:=J, To:=J

You can edit it out if you dont want it to print.
 
Upvote 0
Thanks, but this not resolve it!
Let me comment you.

With my limited programming skill, the first that I did, was to comment this line '.PrintOut. However the code in this way (see below), only write the last page number as a header "0000N" in all page, where N = represent last pagenumber.

With ActiveSheet

For J = 1 To iPages
.PageSetup.RightHeader = Format(J, sFormat)
'.PrintOut From:=J, To:=J
Next J
End With
 
Upvote 0

Forum statistics

Threads
1,215,410
Messages
6,124,755
Members
449,187
Latest member
hermansoa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top