View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Wood Grafing Wood Grafing is offline
external usenet poster
 
Posts: 57
Default VBA Page Setup/Formatting EXTREMELY Slow... Help!

I've noticed this too. Even with screenupdating off, it takes a very long
time to do any page setup. It appears to me that it doesn't make all of the
changes at once, but seems to apply each change indepipendantly, as in, it
goes in, makes a change, backs out, then goes back in for the next one. Turn
screen updating on and watch when page setup is being done, you get a lot of
screen flashes...

"MikeZz" wrote:

I have a sub that disables screen updating before it calls this routine.

Unfortunately, this colde still runs extremely show.
I can create and format 10 sheets including multiple pivot tables in a
fraction of time that it takes just to add simple headers and footers to the
same 10 sheets.

Am I doing something wrong?
Thanks!

Sub Setup_All_Headers()
Dim wb As Workbook
Dim sh As Sheets
Dim c, s

Set wb = ActiveWorkbook
c = Worksheets.Count

For s = 1 To c
Worksheets(s).Activate
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.CenterHeader = "&""Arial,Bold""&20&A&""Arial,Regular""&14" &
Chr(10) & "&F"
.CenterFooter = "Page &P of &N"
.RightFooter = "&D" & Chr(10) & "&T"
.PrintGridlines = True
.CenterHorizontally = True
.CenterVertically = False
.Orientation = xlPortrait
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 3
End With
Next

End Sub