Change text in header when printing using VBA in Microsoft Excel

Question:
How Change text in header when printing .

Place the code below into a regular Module.

Sub VariableRow()
   Dim intCount As Integer, intCounter As Integer
   Range("A1").Select
   intCount = ExecuteExcel4Macro("INDEX(GET.DOCUMENT(50),1)")
   Sheet1.PageSetup.PrintTitleRows = "1:1"
   For intCounter = 1 To intCount
      Range("A1").Value = "RepetitionLine " & intCounter & ". Page"
      ActiveSheet.PrintOut from:=intCounter, to:=intCounter
   Next intCounter
   Range("A1").Value = "RepetitionLine"
End Sub

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.