J
JCIrish
Here is a simple code I've written that returns page break locations, but
only those page breaks that I've inserted manually. It won't return page
breaks that Excel inserts automatically. If I try to get these page breaks I
get the message, "subscript out of range. Can anybody tell me why? And how to
use this type of simple code to get automatic page breaks?
Sub pageBreakA1C1()
'will find only those page breaks that were manually inserted
'won't find those inserted automaticall by Excel
Dim myPageBreakA1C1
myPageBreakA1C1 =
ActiveWorkbook.Worksheets(1).HPageBreaks(2).Location.Address(, , xlR1C1)
Range("A3").Select
Selection = myPageBreakA1C1
Range("A4").Select
Range("A3").ClearContents
End Sub
only those page breaks that I've inserted manually. It won't return page
breaks that Excel inserts automatically. If I try to get these page breaks I
get the message, "subscript out of range. Can anybody tell me why? And how to
use this type of simple code to get automatic page breaks?
Sub pageBreakA1C1()
'will find only those page breaks that were manually inserted
'won't find those inserted automaticall by Excel
Dim myPageBreakA1C1
myPageBreakA1C1 =
ActiveWorkbook.Worksheets(1).HPageBreaks(2).Location.Address(, , xlR1C1)
Range("A3").Select
Selection = myPageBreakA1C1
Range("A4").Select
Range("A3").ClearContents
End Sub