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


Hi!
I would like to clear all page breaks and set a page break between each
change in rows in column A example, I want a page break between row 2
and 3. I'll set row 1 to repeat at the top of the printed page.
A B
1 Dept. Name
2 02 Jack
3 02 Bill
4 03 Bob

How would the code look for a task like this?

As always, any help or direction is greatly appreciated!
And thanks for your time!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=552437

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Page Breaks Macro

Dim dblRow As Double

ActiveSheet.ResetAllPageBreaks

ActiveSheet.PageSetup.PrintTitleRows = "$1:$1"

Range("B2").Select

Do
dblRow = dblRow + 1
If Len(ActiveCell.Offset(dblRow, 0).Value) < 0 Then
If ActiveCell.Offset(dblRow, 0).Value < _
ActiveCell.Offset(dblRow - 1, 0).Value Then
ActiveWindow.SelectedSheets.HPageBreaks.Add _
Befo=ActiveCell.Offset(dblRow, 0)
End If
Else
Exit Sub
End If
Loop


HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Brian Matlack" wrote:


Hi!
I would like to clear all page breaks and set a page break between each
change in rows in column A example, I want a page break between row 2
and 3. I'll set row 1 to repeat at the top of the printed page.
A B
1 Dept. Name
2 02 Jack
3 02 Bill
4 03 Bob

How would the code look for a task like this?

As always, any help or direction is greatly appreciated!
And thanks for your time!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile:
http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=552437


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Page Breaks Macro


Thanks Gary!!
I'll study it to figure-out how but it works great!

--
Brian Matlac
-----------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...nfo&userid=350
View this thread: http://www.excelforum.com/showthread.php?threadid=55243

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
Macro page breaks on column value not row 1 - use value in footer? misscrf[_4_] Excel Programming 1 October 6th 05 07:18 PM
blank row macro with page breaks DKY[_20_] Excel Programming 5 September 28th 05 05:54 PM
Recorded Macro to Set page breaks generates error. Jared Excel Programming 13 December 9th 04 06:45 AM
blank row macro with page breaks DKY[_19_] Excel Programming 0 October 22nd 04 02:20 PM
blank row macro with page breaks DKY[_18_] Excel Programming 1 October 22nd 04 02:09 PM


All times are GMT +1. The time now is 09:32 AM.

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

About Us

"It's about Microsoft Excel"