Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Kim Kim is offline
external usenet poster
 
Posts: 284
Default Excel: how to insert page breaks between all the rows at once?

Excel: how to insert page breaks between all the rows at once?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 154
Default Excel: how to insert page breaks between all the rows at once?

Kim,

Here is a macro that will accomplish what you are asking for. What it does
is add a page break on every row for all used cells.

Go to VBA (ToolsMacroVisual Basic Editor) and create a new Module for the
coding (InsertModule) and paste this code in, close VBA.
Run the Macro from Excel (ToolsMacroMacrosAdd_PageBreaks)

Public Sub Add_PageBreaks()
Dim xlssheet As Worksheet
Set xlssheet = Excel.ActiveSheet
Dim x As Long
Dim y As Long
Dim actcell As String
y = xlssheet.UsedRange.Rows.Count


For x = 2 To y
actcell = "$A$" & x
xlssheet.Range(actcell).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add befo=ActiveCell
Next

End Sub

--
--Thomas [PBD]
Working hard to make working easy.


"Kim" wrote:

Excel: how to insert page breaks between all the rows at once?

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
How do I insert multiple page breaks simultaneously in Excel? marina Excel Discussion (Misc queries) 7 April 4th 23 10:48 AM
How do I insert page breaks in a huge EXCEL file? Robert Judge Excel Discussion (Misc queries) 4 February 18th 08 04:51 PM
insert an excel sheet into a word doc and keep excel page breaks. Diane Excel Discussion (Misc queries) 0 September 10th 07 12:34 AM
How do I insert page breaks in .txt for use in excel? JohnK Excel Discussion (Misc queries) 2 January 19th 07 11:24 PM
Auto insert page breaks in Excel, based on a sort of numbers peterc89 Excel Discussion (Misc queries) 0 November 9th 05 03:41 PM


All times are GMT +1. The time now is 02:37 PM.

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"