J
JR_06062005
In the following macro I have inserted a print preview to reset the
horizontal page break counter in the spreadsheet. Without this accomodation
I can only run the macro once. The second time I run it, I get an out of
range error.
Is there another way to reset the horizontal page break so that each time
the macro runs it starts recognizing the horizontal page breaks from the
beginnging of the spreadsheet?
Sub LineFormatAtPageBreak()
Dim oHPgbr As HPageBreak
ActiveWindow.SelectedSheets.PrintPreview
For Each oHPgbr In ActiveSheet.HPageBreaks
MsgBox "Other row page break at:" & oHPgbr.Location.Address
' Format row at page break
Next
End Sub
horizontal page break counter in the spreadsheet. Without this accomodation
I can only run the macro once. The second time I run it, I get an out of
range error.
Is there another way to reset the horizontal page break so that each time
the macro runs it starts recognizing the horizontal page breaks from the
beginnging of the spreadsheet?
Sub LineFormatAtPageBreak()
Dim oHPgbr As HPageBreak
ActiveWindow.SelectedSheets.PrintPreview
For Each oHPgbr In ActiveSheet.HPageBreaks
MsgBox "Other row page break at:" & oHPgbr.Location.Address
' Format row at page break
Next
End Sub