- Record an Excel macro that puts text into the three sections of the header: Left, Center, and Right.
Excerpt:
Sub Write_Header()
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = "FISH"
.CenterHeader = "CAT"
.RightHeader = "DOG"
End With
Application.PrintCommunication = True
End Sub
- Change the text that gets written in.
Sub Write_Header()
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = "LEFT"
.CenterHeader = "CENTER"
.RightHeader = "RIGHT"
End With
Application.PrintCommunication = True
End Sub
- Run the macro.
The header says "LEFT" "CAT" "RIGHT" and the Center code doesn't work. This was repeatable for Microsoft reps.
How do I write to the center section of the header in Excel using VBA?
My actual code pulls in data from cells, but likewise, Center doesn't work.