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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
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,214,824
Messages
6,121,783
Members
449,049
Latest member
greyangel23

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