Hi,
Any thoughts as to why a '424' error and how to make this work?
It does insert 2 rows at each page break. But then I need to copy the nearest value in column A to the active row.
Sub PageBreaks2()
Dim sh As Worksheet
Set sh = ActiveSheet
Dim hPage As HPageBreak
For Each hPage In sh.HPageBreaks
hPage.Location.EntireRow.Resize(2).Insert Shift:=xlDown
Cells(ActiveCell.Row, "A").Activate
If cell.Offset(-1, 0).Value <> "" Then
cell.Value = cell.Offset(-1, 0).Value
Else
cell.Value = cell.End(xlUp).Value
End If
Next hPage
End Sub
Any thoughts as to why a '424' error and how to make this work?
It does insert 2 rows at each page break. But then I need to copy the nearest value in column A to the active row.
Sub PageBreaks2()
Dim sh As Worksheet
Set sh = ActiveSheet
Dim hPage As HPageBreak
For Each hPage In sh.HPageBreaks
hPage.Location.EntireRow.Resize(2).Insert Shift:=xlDown
Cells(ActiveCell.Row, "A").Activate
If cell.Offset(-1, 0).Value <> "" Then
cell.Value = cell.Offset(-1, 0).Value
Else
cell.Value = cell.End(xlUp).Value
End If
Next hPage
End Sub