View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vacuum Sealed Vacuum Sealed is offline
external usenet poster
 
Posts: 259
Default Method to automate page numbers on single worksheet

Hi Burl

Try this as an example to produce Page of Pages instead of using Cells (
Unless there is another reason you have to point to a cell ).

Sub PrintReport()

Dim myWkS As Worksheet
Set myWkS = ActiveSheet

With myWkS.PageSetup
.RightHeader = "&P" & " of " & "&N"
.FitToPagesWide = 1
End With

myWkS.PrintOut Preview:=True

End Sub

HTH
Mick