Putting page numbers into this macro, How??
On 19 Aug., 08:07, pano wrote:
Hi all I want to get page numbers into this macro if anyone can help
Day1 worksheet checks range ak5:ak40 if that is blank it omits page 5
from first array print *if it is not blank it prints on second array.
I just cant work out how to put page numbers in here..
*The page numbers on Day1 worksheet are 1 - 3 - 5 - 6
Sub Front1()
'Day 1
Application.ScreenUpdating = False
If WorksheetFunction.CountBlank(Sheets("Day1").Range( "AK5:AK40")) = 36
Then
* * Sheets(Array("1 To:=1,", "3, To:=3,", "6, To:=6,")).Select
Else
* * Sheets(Array("From:=1, To:=1,", "From:=3, To:=3", "From:=5,
To:=5,", "From:=6, To:=6,")).Select
End If
Sheets("1").Activate
ActiveWindow.Selectedpages.PrintOut Copies:=1, Collate:=True
Sheets("PrintMenu").Select
Application.ScreenUpdating = True
End Sub
Ta for any help
hi pano, you can use PageSetup for the page numbers, eg
Sub Front1()
'Day 1
Application.ScreenUpdating = False
If WorksheetFunction.CountBlank( _
Sheets("Day1").Range("AK5:AK40")) = 36 Then
arr = Array(1, 3, 6)
Else
arr = Array(1, 3, 5, 6)
End If
For Each sh In Sheets(arr)
sh.PageSetup.CenterHeader = "page " & sh.Index
sh.PrintOut Copies:=1, Collate:=True
Next
Sheets("PrintMenu").Select
Application.ScreenUpdating = True
End Sub
different positions are possible: left/center/rightheader and footer.
stefan
|