Sheets print header vba and an easer egg?

CsJHUN

Active Member
Joined
Jan 13, 2015
Messages
360
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
  2. Mobile
Hi guys,

Yesterday i had a job to make a vba to pagination. That was the working results.
Code:
Sub sheetcounter()
For i = 2 To Sheets.Count
Sheets(i).Select
    Application.PrintCommunication = False
    With ActiveSheet.PageSetup
        .RightHeader = "&B &Kpch&J" & ActiveSheet.Index - 1 & "\" & Sheets.Count - 1
    End With
    Application.PrintCommunication = True
Next i
End Sub

By solving this "problem" some questions comes up:
- i cannot set it like the below code, because the right always pulled the left and centre together in centre. Why? Its a bug or feature? Or i missed something?
Code:
With ActiveSheet.PageSetup
.LeftHeader =  "someinleft"
.CenterHeader = "someincentre"
.RightHeader = "someinright"
End With
- the prefixes (&B ...&K...&J) made me curious because this is the first letters of the Hungarian version of the left (bal), center (közép) and right (jobb). Is this letters fits to any other language? I know Charles Simony is Hungarian, and the leader of programing the excel (and word), but never imagined and easeregg like this.

Any opinion are welcome :)
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi

Both codes below give me the same result:

Code:
Sub Hun()
With ActiveSheet.PageSetup
    .LeftHeader = "left"
    .CenterHeader = "center"
    .RightHeader = "right"
End With
End Sub


Sub Hun2()
ActiveSheet.PageSetup.RightHeader = "&Lleft&Ccenter&Rright"
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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