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

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

--
yepidu