Right now I am attempting to use a separate macro to reset the page
numbers. The code above inserts the page breaks. I would like to modify
the code below to set the variable p and then the page number to 1 for
manual page breaks. For automatic page breaks, p will be incremented by
1 and then the page number set to p. I don't know how to specify which
page on the worksheet should be set equal to p. Is there a way to do
that? I believe the line of code "ActiveSheet.PageSetup.RightFooter =
p" will have to be replaced or modified with a line specifying the page
of the worksheet. As it is now, each page will have the same page number
(not what I want).
Or is there a better way?
Thanks for any suggestions.
Code:
--------------------
Sub CheckForPageBreaks()
Dim i As Integer
Dim p As Integer
p = 0
For i = 1 To ActiveSheet.UsedRange.Rows.Count
If Rows(i).PageBreak = xlManual Then
'manual page break above row
'With ActiveSheet
p = 1
ActiveSheet.PageSetup.RightFooter = p
ElseIf Rows(i).PageBreak = xlAutomatic Then
'automatic page break above row
p = p + 1
ActiveSheet.PageSetup.RightFooter = p
End If
Next
End Sub
--------------------
--
DavidW
------------------------------------------------------------------------
DavidW's Profile:
http://www.excelforum.com/member.php...o&userid=32630
View this thread:
http://www.excelforum.com/showthread...hreadid=542155