template + page numbers

  • Thread starter Thread starter someday
  • Start date Start date
S

someday

I have a template with a cell reserved for the page number. I need to print
the template 200 times with the page number incrementing for each page
printed.

In other words, the first page printed to read 1, second page 2, the third
3, etc.

How can I get this cell to increment 1 for each page printed.

Thank you in advance.
 
You could use the workbook_beforeprint() event to increment the cell

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Worksheets("Sheet1").Range("A1").Value = _
Worksheets("Sheet1").Range("A1").Value + 1
End Sub

See here for implementation

http://www.nickhodge.co.uk/vba/vbaimplement.htm#EventCode

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Back
Top