No, it won't. You have to print the workbook one sheet at a time -- with a
macro -- setting the page number in the appropriate cell before each sheet is
printed. Something similar to the code below (untested, but should be close)
should do it. I assumed you have two named ranges, TotalPages and PageNum, to
receive the values. Note that this assumes the worksheet is only one page wide
but multiple pages tall. It that isn't true, the code would have to be
modified to put the page numbers farther to the right on the subsequent pages,
and you would have to work out the logic of where those cells are for each
printed page. That, in turn, depends on whether you are printing down-then
across, or across-then down.
Sub PrintWithPgNumInTitleRow()
Dim NumPages As Long, Pg As Long
NumPages = ExecuteExcel4Macro("Get.document(50,"")")
ActiveSheet.Range("TotalPages").Value = NumPages
For Pg = 1 To NumPages
With ActiveSheet
.Range("PageNum").Value = Pg
.PrintOut from:=Pg, to:=Pg
End With
Next Pg
End Sub
As that would be preferable to invoking a print for one page at a time,
if that is an option.
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://members.aol.com/dmcritchie/excel/excel.htm