rng.PageBreak = <Unable to get the PageBreak property of the

Joined
Nov 18, 2011
Messages
2
Reaction score
0
Sub InsertPageBreak()
'
' InsertPageBreak Macro
'

'
Dim OldVal As String
Dim rng As Range
OldVal = Range("A1")
For Each rng In Range("A1:A4500") '<< change range
If rng.Text <> OldVal Then
rng.PageBreak = xlPageBreakManual
OldVal = rng.Text
End If
Next rng
End Sub


Here is the problem.. The macro will run through about 1300 cells then it will freeze and give me a debug option and then tells me the rng.PageBreak = xlPageBreakManual is broken some how -

I think this is the error I am getting -

rng.PageBreak = <Unable to get the PageBreak property of the Range class

Any Ideas?
 
Back
Top