Roman numerals


Posted by Jennifer on February 13, 2001 6:28 AM

OK, here is my code:

Worksheets("Sheet1").Activate
For Each sht In Worksheets
sht.Activate
PageCount = 0
Pages = ExecuteExcel4Macro("Get.Document(50)")
For PageCount = 1 To Pages
PageCount = PageCount + 1
ActiveSheet.PageSetup.RightFooter = Application.WorksheetFunction.Roman(PageCount)
Next PageCount
Next sht

I am trying to number the pages in my workbook with Roman numerals. I found the above code in the mrexcel archives. Unfortunately it seems to only print the last page number on all of my pages.

Any thoughts?

Thanks!
Jen

Posted by Faster on February 13, 2001 8:05 AM

Jen:

Maybe include in your loop a statement to print the
current page after in is numbered. Interesting problem.

Posted by Tim Francis-Wright on February 13, 2001 8:17 AM

(snip)

I'd leave out the lines
PageCount = 0
and
PageCount = PageCount + 1
especially the second one--it's inside
the PageCount loop, so PageCount is trying
to go from 1 to Pages in the loop, but is
instead going from 2 to Pages by 2s.

Hope this helps.



Posted by Celia on February 13, 2001 3:44 PM

Here's a macro from (broken link) .
As suggested by Faster, it would appear that you have to put your print code just before the line Next Page Count.

Sub RomanPrintLoop()
Application.ScreenUpdating = False
RetSheet = ActiveSheet.Name
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Select
Pages = ExecuteExcel4Macro("Get.Document(50)")
For i = 1 To Pages
n = n + 1
Sheet.PageSetup.CenterFooter = WorksheetFunction.Roman(n)
ActiveWindow.SelectedSheets.PrintOut From:=i, To:=i, Copies:=1, Collate:=True
Next i
Next Sheet
Sheets(RetSheet).Select
Application.ScreenUpdating = True
End Sub

Celia