R
Rich Mogy
I have written a macro that will insert page breaks in my workbook everytime
the word "Date:" is found.
How can I eliminate Excel's automatic page breaks and use only my manual
page breaks?
Thank you in advance.
Rich Mogy
Here is the macro:
Sub pagebreaker3()
'
Dim FirstAddress As String
'
Range("A2").Select
Set c = Cells.Find(What:="Date:", After:=ActiveCell, _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=True)
'above saves the address of the find
If Not c Is Nothing Then
FirstAddress = c.Address 'saves first address
Range(c.Address).Select 'selects row with address
Else
Exit Sub
End If
Do Until c.Address = "$A$1"
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
'inserts page break
Set c = Cells.FindNext(c) 'finds next occurrence
Range(c.Address).Select 'select row with next occurrence
Loop
End Sub
the word "Date:" is found.
How can I eliminate Excel's automatic page breaks and use only my manual
page breaks?
Thank you in advance.
Rich Mogy
Here is the macro:
Sub pagebreaker3()
'
Dim FirstAddress As String
'
Range("A2").Select
Set c = Cells.Find(What:="Date:", After:=ActiveCell, _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=True)
'above saves the address of the find
If Not c Is Nothing Then
FirstAddress = c.Address 'saves first address
Range(c.Address).Select 'selects row with address
Else
Exit Sub
End If
Do Until c.Address = "$A$1"
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
'inserts page break
Set c = Cells.FindNext(c) 'finds next occurrence
Range(c.Address).Select 'select row with next occurrence
Loop
End Sub