Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,388
Default Stop page breaks in the middle of merged cells

I have a macro that generates a report that has merged cells. Can I get the
page breaks not to split any merged cells?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Stop page breaks in the middle of merged cells

I think you'll have to use manual page breaks and put them where you want them.

dave wrote:

I have a macro that generates a report that has merged cells. Can I get the
page breaks not to split any merged cells?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 187
Default Stop page breaks in the middle of merged cells

Dave,

Where have you been all these days? I missed you a lot.

Regards,

Jaleel

"Dave Peterson" wrote:

I think you'll have to use manual page breaks and put them where you want them.

dave wrote:

I have a macro that generates a report that has merged cells. Can I get the
page breaks not to split any merged cells?


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Stop page breaks in the middle of merged cells

Still hanging around here.



Jaleel wrote:

Dave,

Where have you been all these days? I missed you a lot.

Regards,

Jaleel

"Dave Peterson" wrote:

I think you'll have to use manual page breaks and put them where you want them.

dave wrote:

I have a macro that generates a report that has merged cells. Can I get the
page breaks not to split any merged cells?


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,388
Default Stop page breaks in the middle of merged cells

Dave,
I figured out a way within a macro to force the page breaks to a specific
row. I want to use the same macro for worksheets with multiple pages and some
with only one page. The macro crashes if I set the page breaks for more rows
than there are data for. I found the following "If" statement for a different
page break problem. I don't fully understand all the coding. I there some
type of if statement that will set the the page breaks at a known location
only if there is data that many rows down?

If your data looks like this

east
east
east
west
west
west
etc
etc
etc

This macro will insert a pagebreak at each change of data column A

Sub InsertBreak_At_Change()
Dim i As Long
For i = Selection.Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And Not IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub

"Dave Peterson" wrote:

Still hanging around here.



Jaleel wrote:

Dave,

Where have you been all these days? I missed you a lot.

Regards,

Jaleel

"Dave Peterson" wrote:

I think you'll have to use manual page breaks and put them where you want them.

dave wrote:

I have a macro that generates a report that has merged cells. Can I get the
page breaks not to split any merged cells?

--

Dave Peterson


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Stop page breaks in the middle of merged cells

I'm not sure why your macro breaks, but maybe you could pick out a column that
you can "group" by and use something like this:

Option Explicit
Sub testme()

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long

With Worksheets(1)
.ResetAllPageBreaks
FirstRow = 2
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For iRow = LastRow To FirstRow + 1 Step -1
If .Cells(iRow, "A").Value = .Cells(iRow - 1, "A").Value Then
'do nothing, same group
Else
.HPageBreaks.Add Befo=.Cells(iRow, "A")
End If
Next iRow
End With
End Sub

But this doesn't address any merged cells.





dave wrote:

Dave,
I figured out a way within a macro to force the page breaks to a specific
row. I want to use the same macro for worksheets with multiple pages and some
with only one page. The macro crashes if I set the page breaks for more rows
than there are data for. I found the following "If" statement for a different
page break problem. I don't fully understand all the coding. I there some
type of if statement that will set the the page breaks at a known location
only if there is data that many rows down?

If your data looks like this

east
east
east
west
west
west
etc
etc
etc

This macro will insert a pagebreak at each change of data column A

Sub InsertBreak_At_Change()
Dim i As Long
For i = Selection.Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And Not IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub

"Dave Peterson" wrote:

Still hanging around here.



Jaleel wrote:

Dave,

Where have you been all these days? I missed you a lot.

Regards,

Jaleel

"Dave Peterson" wrote:

I think you'll have to use manual page breaks and put them where you want them.

dave wrote:

I have a macro that generates a report that has merged cells. Can I get the
page breaks not to split any merged cells?

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
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
merged cells and hyperlinks wannabee Links and Linking in Excel 0 October 11th 06 03:08 PM
Automatic page breaks Bob Johnson Excel Discussion (Misc queries) 0 September 28th 06 05:38 PM
merged cells don't center over columns to repeat at left trimatrixlabs Excel Discussion (Misc queries) 0 September 25th 06 04:39 PM
Blank Rows from Merged Cells in Drop Down Menu Kati Excel Discussion (Misc queries) 1 February 20th 06 07:59 PM
How do I stop automatic page breaks in excel Lesley Hutchinson Excel Worksheet Functions 0 October 31st 04 12:49 PM


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