Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
merged cells and hyperlinks | Links and Linking in Excel | |||
Automatic page breaks | Excel Discussion (Misc queries) | |||
merged cells don't center over columns to repeat at left | Excel Discussion (Misc queries) | |||
Blank Rows from Merged Cells in Drop Down Menu | Excel Discussion (Misc queries) | |||
How do I stop automatic page breaks in excel | Excel Worksheet Functions |