Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Insert Page Break
Is it possible to insert a page break automatically when specific text is
encountered in row A. This report is hundreds of pages long and I need an automatic page insert macro. Can someone give me the syntax of a macro if the specific text is "Break"? Thanks for any help. -- Don Rountree |
#2
|
|||
|
|||
Hi Don
Try Sub Macropagebreak() For Each CELL In Range("A:A") If CELL = "BREAK" Then CELL.Rows.Select ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell Else End If Next End Sub "Don" wrote: Is it possible to insert a page break automatically when specific text is encountered in row A. This report is hundreds of pages long and I need an automatic page insert macro. Can someone give me the syntax of a macro if the specific text is "Break"? Thanks for any help. -- Don Rountree |
#3
|
|||
|
|||
Thank you for your help. I entered this macro and when I ran it I got the
error message that said - Complie error, variable not defined. The first instance of the word CELL was highlighted. Please tell me how to define this variable. -- Don Rountree "tina" wrote: Hi Don Try Sub Macropagebreak() For Each CELL In Range("A:A") If CELL = "BREAK" Then CELL.Rows.Select ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell Else End If Next End Sub "Don" wrote: Is it possible to insert a page break automatically when specific text is encountered in row A. This report is hundreds of pages long and I need an automatic page insert macro. Can someone give me the syntax of a macro if the specific text is "Break"? Thanks for any help. -- Don Rountree |
#4
|
|||
|
|||
Sub MacroPageBreak()
Dim Cell as Range '<-- add this line '''rest of code here Don wrote: Thank you for your help. I entered this macro and when I ran it I got the error message that said - Complie error, variable not defined. The first instance of the word CELL was highlighted. Please tell me how to define this variable. -- Don Rountree "tina" wrote: Hi Don Try Sub Macropagebreak() For Each CELL In Range("A:A") If CELL = "BREAK" Then CELL.Rows.Select ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell Else End If Next End Sub "Don" wrote: Is it possible to insert a page break automatically when specific text is encountered in row A. This report is hundreds of pages long and I need an automatic page insert macro. Can someone give me the syntax of a macro if the specific text is "Break"? Thanks for any help. -- Don Rountree -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Page scaling & Page break preview prob | Excel Discussion (Misc queries) | |||
How do I delete the page watermark in the page break preview? | Excel Discussion (Misc queries) | |||
How do I change "PAGE 1" characteristics in page break? | Excel Discussion (Misc queries) | |||
adding a new page break to an existing page break | Excel Discussion (Misc queries) | |||
content does not stay in page break | Excel Worksheet Functions |