Question with existing page numbering macro?
Hi Newbeetle,
Try suspending recalcs and using a loop, like:
Sub workbook_BeforePrint(Cancel As Boolean)
Dim wsSheet As Worksheet
' Stop Re-Calcs
Application.Calculation = xlManual
' Loop through all sheets
For Each wsSheet In ActiveWorkbook.Worksheets
wsSheet.PageSetup.CenterFooter = "" & wsSheet.Range("A1").Text
Next wsSheet
' Restore Re-Calcs
Application.Calculation = xlAutomatic
End Sub
Cheers
--
macropod
[MVP - Microsoft Word]
"Newbeetle" wrote in message ...
| Hi the code below is an abstract from a macro I use to automatically page
| numbers when printing,
|
| Sub workbook_BeforePrint(Cancel As Boolean)
| With Worksheets("sheet1")
| .PageSetup.CenterFooter = "" & .Range("A1").Text
| End With
|
| With Worksheets("sheet2")
| .PageSetup.CenterFooter = "" & .Range("a1").Text
| End With
|
| 'etc etc
|
| End Sub
|
| The macro functions as required and is placed within Thisworkbook.
|
| As the number of pages have grown to 20, the macro will only function if I
| press print preview before printing, otherwise the page numbering is not
| updated. I'm guessing the print function is quicker than the macro and it
| doesn't get chance to complete.
|
| Not the end of the world, but I just wondered if there was a way to get
| around this to allolw the macro enough time to complete before the printing
| starts?
|
|
| --
| This post was created using recycled electrons!
|