Forum Discussion
AprilW
Jul 08, 2021Copper Contributor
cloning headers & footers in excel
I am adding some pages to a workbook, I don't want to manually type out all the information I have in the footers & the headers - how do I copy those settings from existing pages to the new pages?
AprilW
Jul 08, 2021Copper Contributor
NikolinoDE thanks, that is what I have done in the past, but that involves recreating them again, and each time it is the same information, just a pain in my butt
NikolinoDE
Jul 08, 2021Platinum Contributor
Maybe a try with VBA :))
Option Explicit
Sub head_and_footer()
Dim wks As Worksheet, wks_def As Worksheet
Set wks_def = Sheets("YourWorksheet")
For Each wks In ThisWorkbook.Sheets
With wks.PageSetup
.LeftHeader = wks_def.PageSetup.LeftHeader
.CenterHeader = wks_def.PageSetup.CenterHeader
.RightHeader = wks_def.PageSetup.RightHeader
.LeftFooter = wks_def.PageSetup.LeftFooter
.CenterFooter = wks_def.PageSetup.CenterFooter
.RightFooter = wks_def.PageSetup.RightFooter
End With
Next wks
End Sub
Thank you for your patience and time.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote any reply if it helps please, as it will be beneficial to more Community members reading here.