Inserting Page Breaks every 40 lines...

  • Thread starter Thread starter Trevor Hargrove
  • Start date Start date
T

Trevor Hargrove

Hello all,

I would like to be able to insert a page break every 40 lines of a
large file. Is this possible either through add-ins or via VB code?
Any help is appreciated.

Thanks,

Trevor
 
Trevor said:
Hello all,

I would like to be able to insert a page break every 40 lines of a
large file. Is this possible either through add-ins or via VB code?
Any help is appreciated.

Hi, you can use this... I guess you better adapt it to your needs,
because it takes a while to add them. 1026 is the max number of
linebreaks in a spreadsheet.

For i = 1 To 1026
ActiveWindow.SelectedSheets.HPageBreaks.Add _
Before:=Cells(i * 40 + 1, 1)
Next i

At least this should get you started. It would be better if you add some
code to detect when the data has ended.
Regards,
 
Back
Top