Dim i as Long
i = 0
For Each HPB In Asheet.HPageBreaks
i = i + 1
if HPB.Type = xlPageBreakManual or i = ASheet.HPageBreaks.count then
Set Nsheet = Worksheets.Add(after:=WB.Sheets(WB.Sheets.Count))
On Error Resume Next
Nsheet.Name = "Page " & PageNum
If Err.Number 0 Then
MsgBox "Change the name of : " & Nsheet.Name & " manually"
Err.Clear
End If
On Error GoTo 0
With Asheet
.Range(.Cells(RW, "A"), .Cells(HPB.Location.Row - 1, "K")).Copy _
Nsheet.Cells(1)
End With
' If you want to make values of your formulas use this line also
' Nsheet.UsedRange.Value = Nsheet.UsedRange.Value
RW = HPB.Location.Row
PageNum = PageNum + 1
End if
Next HPB
--
Regards,
Tom Ogilvy
"okrob" wrote:
For this routine, I'd like to only make a new page for the Manual
HpageBreaks... Ron - Can you help?
Rob
http://www.rondebruin.nl/hpagebreaks.htm