Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code to insert a Page Break

I would like to know if it is possible to write a VB code
to insert page breaks into a spreadsheet when a value is
encountered in a column. I am using Excel 2002
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Code to insert a Page Break

I'd modify JE's code slightly to avoid A1 and maybe remove all the existing page
breaks.

Option Explicit
Sub test()

Const MYVAL As Double = 1
Dim cell As Range

ActiveSheet.ResetAllPageBreaks

For Each cell In Range("A2:A" & _
Range("A" & Rows.Count).End(xlUp).Row)
If cell.Value = MYVAL Then _
ActiveSheet.HPageBreaks.Add Befo=cell
Next cell

End Sub

Moore wrote:

I would like to know if it is possible to write a VB code
to insert page breaks into a spreadsheet when a value is
encountered in a column. I am using Excel 2002


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code to insert a Page Break

Thanks for the info, the code worked beautifully.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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 Page Break da Excel Discussion (Misc queries) 2 May 11th 09 07:05 PM
How do I insert a page break between every row and column? Ashley Excel Discussion (Misc queries) 2 February 26th 09 03:21 AM
INSERT ROW AND PAGE BREAK jcontrer Excel Discussion (Misc queries) 0 May 15th 08 07:09 PM
cannot insert page break tsmanz Excel Discussion (Misc queries) 2 December 5th 05 05:45 PM
Insert Page Break Don Excel Discussion (Misc queries) 3 June 9th 05 08:32 PM


All times are GMT +1. The time now is 08:35 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"