Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Unable to insert Pagebreak before row 1108 !!

I tried your code and got this message

Run-time error '1004'

The action exceeds the number of page breaks you can manually add to a
worksheet. A worksheet can contain up to 1026 horizontal page breaks.

Do you really want that many page breaks???

--
HTH,
Barb Reinhardt



"Filips Benoit" wrote:

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Unable to insert Pagebreak before row 1108 !!

Hey,

1. observation:

iHorizPageBreakCount = .HPageBreaks.Count

Inserting the codeline above to show the numbre of Horizontal PageBreaks
when the error occurs shows that
in my case the error 1004 occures in row 1108 and iHorizPageBreakCount = 20
!!

2. observation:

The problem is solved if I delete row 1108 and insert a new row just
like is was before.
Then - no error - a msgbox at the end of the routine shows that
iHorizPageBreakCount = 31 !!


Filip



"Barb Reinhardt" wrote in message
...
I tried your code and got this message

Run-time error '1004'

The action exceeds the number of page breaks you can manually add to a
worksheet. A worksheet can contain up to 1026 horizontal page breaks.

Do you really want that many page breaks???

--
HTH,
Barb Reinhardt



"Filips Benoit" wrote:

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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Unable to insert Pagebreak before row 1108 !!

Dear All,

Problem: The code could not isert a HPageBreak in the active PrintArea !!!

I added 1 codeline to clear the PrintArea
ActiveSheet.PageSetup.PrintArea = ""

Filip


"Barb Reinhardt" wrote in message
...
I tried your code and got this message

Run-time error '1004'

The action exceeds the number of page breaks you can manually add to a
worksheet. A worksheet can contain up to 1026 horizontal page breaks.

Do you really want that many page breaks???

--
HTH,
Barb Reinhardt



"Filips Benoit" wrote:

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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert pagebreak when a specific word appears in a column. Neal Excel Discussion (Misc queries) 4 October 27th 08 11:17 PM
Cant move pagebreak in PageBreak View in Excel2003 Vasanthan Excel Worksheet Functions 1 August 22nd 07 03:28 PM
Insert row after pagebreak amepluie Excel Programming 2 January 3rd 07 09:46 AM
INSERT HORIZONTAL PAGEBREAK AFTER EACH LINE IN ENTIRE WORKSHEET . KNPALIA Excel Worksheet Functions 1 October 27th 06 05:46 PM
insert pagebreak after a specific column? Macroman Excel Programming 0 August 3rd 06 12:16 PM


All times are GMT +1. The time now is 06:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"