View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Filips Benoit[_2_] Filips Benoit[_2_] is offline
external usenet poster
 
Posts: 27
Default Unable to insert Pagebreak before row 1108 !!

Dear All,

Before printing ( using code under commandbutton) the code inserts
pagebreaks before each chapter ( column 1 not empty).
Works fine about 1 year !
Suddenly in 1 worksheet before row 1108 it is not possible to insert a
pagebreak, Not by code and NOT manualy.
The code triggers error 1004 Application-defined or objecdefined error.

Do YOU know a possible cause for this behavior.


If bSetPagebracksChapters = True Then
With ActiveSheet
.ResetAllPageBreaks
iLastSourceRow = .Cells(Rows.Count, "A").End(xlUp).Row
'Search for the last row with data in Column A
For iRow_Index = 2 To iLastSourceRow Step 1
If IsEmpty(.Cells(iRow_Index, 1).Value) Then
Else
.HPageBreaks.Add Befo=.Cells(iRow_Index, 1)
<<<< This line triggers error 1004 on row 1108 only !!!!!
End If
Next
End With
End If

Thanks,

Filip