How to copy page breaks across from one sheet to existing sheet

T

Tim Stoner

Hi All ,
is there any way of copying page breaks from one sheet to existing
sheets in the same work book , with out damaging data and cell links ??
Many thanks
Tim
 
I

isabelle

hi Tim,

Sub CopyAllPageBreaks()
Dim i As Integer, x As Integer
Sheets(1).PageSetup.PrintArea = "$A$1:$A$65535"

For i = 1 To Sheets(1).HPageBreaks.Count
x = Sheets(1).HPageBreaks(i).Location.Row
With Sheets(2)
.HPageBreaks.Add .Cells(x, 1)
End With
Next

For i = 1 To Sheets(1).VPageBreaks.Count
x = Sheets(1).VPageBreaks(i).Location.Column
With Sheets(2)
.VPageBreaks.Add .Cells(1, x)
End With
Next

End Sub


Sub DeleteAllHPageBreaks()
ActiveSheet.ResetAllPageBreaks
End Sub


--
isabelle



Le 2012-09-12 22:05, Tim Stoner a écrit :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top