chomsky
Board Regular
- Joined
- Mar 13, 2009
- Messages
- 178
To do this Header And Footer in a lot of sheets.
Code:
Sub WorksheetLoopPL()
Dim WS_Count As Integer
Dim i As Integer
' Set WS_Count equal to the number of worksheets in the active
' workbook.
WS_Count = ActiveWorkbook.Worksheets.Count
' Begin the loop.
For i = 1 To WS_Count
Worksheets(i).Activate
'Header y Footer
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = "&A" & Chr(10) & "Hora Comienzo:"
.CenterHeader = Worksheets(1).Range("A3").Value & Chr(10) & "Nombre:"
.RightHeader = "&A" & Chr(10) & "Hora Salida:"
.LeftFooter = "&BPioneer, A DuPont Company Confidential&B"
.CenterFooter = "&D"
.RightFooter = "Page &P"
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 95
.PrintErrors = xlPrintErrorsDisplayed
End With
Application.WindowState = xlMinimized
Application.WindowState = xlNormal
Next i
End Sub