page break automatic macro

Y

yepidu

I need to insert a page break when 2 conditions are met.

I currently have:
Sub PageBreak()
Dim IngRow As Long
For IngRow = 2 To Cells(Rows.Count, "D").End(xlUp).Row + 1
If Range("D" & IngRow) <> Range("D" & IngRow - 1) Then
ActiveSheet.HPageBreaks.Add Before:=Range("F" & IngRow)
End If
Next

End

But I also need consider if column F is greater than 0, insert page break
after row.

883 456789 john wayne 2.25 25.00
883 123456 john wayne 1.75 22.50

-------------------------------------------------
*** 47.50
--------------------------------------------------

887 789123 Steven Segal 3.45 34.50
887 345678 Steven Segal 4.45 44.50

I would like to see the line when column "A" changes, but after space and
after total.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top