View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
yepidu yepidu is offline
external usenet poster
 
Posts: 7
Default page break automatic macro

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 Befo=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.

--
yepidu