R
Rookie 1st class
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveWorkbook.Sheets
N = WorkSheets("Cover").Range("MyPages").Value
If Range("A1") >= 1 Then
ActiveSheet.PageSetup.RightHeader = "&""Arial Narrow,Regular""&8Page
&P of " & N
Else
ActiveSheet.PageSetup.RightHeader = "" '< Runs out back door
hugs a few trees>
End If
End With
End Sub
Works but only changes heading on active sheet. I want to change the header
on every sheet (5 or 9 depending).
I don't want to name the workbook as it may change. Path may change as well.
Do I need loop statement? Quite happy I got this far.
The P is actually [P] - [PAGES], is there a way to easily display these
hidden characters?
I found "VB help, with, control flow keyword summary", seems to help. Any
other suggested sources?
Thanks Lou
With ActiveWorkbook.Sheets
N = WorkSheets("Cover").Range("MyPages").Value
If Range("A1") >= 1 Then
ActiveSheet.PageSetup.RightHeader = "&""Arial Narrow,Regular""&8Page
&P of " & N
Else
ActiveSheet.PageSetup.RightHeader = "" '< Runs out back door
hugs a few trees>
End If
End With
End Sub
Works but only changes heading on active sheet. I want to change the header
on every sheet (5 or 9 depending).
I don't want to name the workbook as it may change. Path may change as well.
Do I need loop statement? Quite happy I got this far.
The P is actually [P] - [PAGES], is there a way to easily display these
hidden characters?
I found "VB help, with, control flow keyword summary", seems to help. Any
other suggested sources?
Thanks Lou