View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Josh Craig Josh Craig is offline
external usenet poster
 
Posts: 40
Default Page Breaks based on cell data

Works like a charm. Thanks heaps, Steel Monkey.

"Steel Monkey" wrote:


Here is what i would do
Assuming the data in column a has been sorted i would write a macro
with the following code:

Sub pagebreak()
Dim value1 As String
Dim value2 As String

Range("A2").Select
Do While ActiveCell.Value < ""
value1 = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
value2 = ActiveCell.Value
If value1 < value2 Then
ActiveCell.EntireRow.Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell
Else
End If
Loop
End Sub


--
Steel Monkey
------------------------------------------------------------------------
Steel Monkey's Profile: http://www.excelforum.com/member.php...o&userid=29051
View this thread: http://www.excelforum.com/showthread...hreadid=558694