R
Randy
Why won't the following macro work to create a page break - in particular it
is giving me an error at the InStr line
Sub b8Pagebrk()
Dim theRange As Range
Dim lastrow&, firstRow&, x&
Set theRange = ActiveSheet.UsedRange
lastrow = theRange.Cells(theRange.Cells.Count).Row
firstRow = theRange.Cells(1).Row
For x = lastrow To firstRow Step -1
If InStr(1, Cells(x, 1), "Total") > 0 Then
Cells(x + 1, 1).PageBreak = xlManual
End If
Next
End Sub
is giving me an error at the InStr line
Sub b8Pagebrk()
Dim theRange As Range
Dim lastrow&, firstRow&, x&
Set theRange = ActiveSheet.UsedRange
lastrow = theRange.Cells(theRange.Cells.Count).Row
firstRow = theRange.Cells(1).Row
For x = lastrow To firstRow Step -1
If InStr(1, Cells(x, 1), "Total") > 0 Then
Cells(x + 1, 1).PageBreak = xlManual
End If
Next
End Sub