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?
'
' 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?