A
andy
Please will someone show me how to change this to read
forward through the worksheet, not from the end?
Sub PagebreakOnOCA()
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For row_index = lastrow To 1 Step -1
If Cells(row_index, "A").Value <> "" Then
If Mid(Cells(row_index, "A").Value, 1, 5) <> "OCA S" And
_ Mid(Cells(row_index, "A").Value, 1, 3) = "OCA" Then
HoldOCAPrior = HoldOCA
HoldOCA = Cells(row_index, "A").Value
If HoldOCAPrior <> HoldOCA Then
ActiveSheet.HPageBreaks.Add Before:= _
Cells(row_index - 2, "A")
End If
End If
End If
Next
End Sub
Thank you in advance
God bless you
forward through the worksheet, not from the end?
Sub PagebreakOnOCA()
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For row_index = lastrow To 1 Step -1
If Cells(row_index, "A").Value <> "" Then
If Mid(Cells(row_index, "A").Value, 1, 5) <> "OCA S" And
_ Mid(Cells(row_index, "A").Value, 1, 3) = "OCA" Then
HoldOCAPrior = HoldOCA
HoldOCA = Cells(row_index, "A").Value
If HoldOCAPrior <> HoldOCA Then
ActiveSheet.HPageBreaks.Add Before:= _
Cells(row_index - 2, "A")
End If
End If
End If
Next
End Sub
Thank you in advance
God bless you