I have the following code that is very slow - could someone please advise if there is a way to speed up this function:
For Each ws In Worksheets
ActiveSheet.DisplayPageBreaks = False
With ActiveSheet.PageSetup
.CenterHeader = "&A"
.CenterFooter = "Page &P of &N"
.LeftMargin = Application.InchesToPoints(0.236220472440945)
.RightMargin = Application.InchesToPoints(0.236220472440945)
.TopMargin = Application.InchesToPoints(0.708661417322835)
.BottomMargin = Application.InchesToPoints(0.708661417322835)
.HeaderMargin = Application.InchesToPoints(0.511811023622047)
.FooterMargin = Application.InchesToPoints(0.511811023622047)
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With
Next ws
For Each ws In Worksheets
ActiveSheet.DisplayPageBreaks = False
With ActiveSheet.PageSetup
.CenterHeader = "&A"
.CenterFooter = "Page &P of &N"
.LeftMargin = Application.InchesToPoints(0.236220472440945)
.RightMargin = Application.InchesToPoints(0.236220472440945)
.TopMargin = Application.InchesToPoints(0.708661417322835)
.BottomMargin = Application.InchesToPoints(0.708661417322835)
.HeaderMargin = Application.InchesToPoints(0.511811023622047)
.FooterMargin = Application.InchesToPoints(0.511811023622047)
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With
Next ws