storemannequin
Board Regular
- Joined
- May 29, 2010
- Messages
- 108
Trying to figure out what's wrong here that this recorded macro, when put inside a loop, only works on the activesheet and no others:
Code:
Sub HeaderFooter()
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
With ws
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
.LeftHeader = "&""Arial,Bold""&12This" & Chr(10) & "dsf#" & Chr(10) & "_______(dE)"
.CenterHeader = "&""Arial,Bold""&16CUSTOMER NAME" & Chr(10) & "REPORT NAME&""Arial,Regular""&10" & Chr(10) & "&""Arial,Bold""&12MM/DD/YYYY"
.RightHeader = "&""Arial,Bold""&12Date Created:" & Chr(10) & "MM/DD/YYYY"
.LeftFooter = "&F DK"
.CenterFooter = ""
.RightFooter = "QTY= Quantity Shipped " & Chr(10) & "Afd= Avd " & Chr(10) & "EXT= Extended Sales"
.CenterFooter = "Page &P of &N" & Chr(10) & "Proprietary Information"
.CenterHorizontally = True
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintGridlines = True
End With
End With
Next ws
End Sub