Method to automate page numbers on single worksheet

B

burl_h

I have a single worksheet, on this worksheet i have a range that can
be a minimum of 2 full to an infinite number 8/12" X 11" sheets when
printed.

at the top of the worksheet, example cell h5 i want to display the
following:-

Page 1 of X (x being the number of pages in the print range)

The subsequent pages that are printed the page number field will be at
cell H55, H105, H155....... etc.

The worksheet starts out with a single sheet, I call the header page,
all subsequent ranges are added with a macro button and are placed
directly below the last added range, for example, the last cell with
content is A49, then the range to insert will start at A50 etc etc

How can I create a method to have cell H55, H105, H155...... display
the Page 2 of X, Page 3 of X etc etc.

Cheers
burl_h
 
V

Vacuum Sealed

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top