M
Maarkr
Need to have a page break before every instance of *dept* in a column... this
doesn't work. Do multiple columns mess it up?
Cells.PageBreak = xlPageBreakNone
col = 1
LastRw = 3300
For x = 1 To LastRw
If Cells(x, col).Value = "*dept*" Then 'or like "*dept*"
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Rows(x)
End If
Next
ActiveWindow.View = xlPageBreakPreview
'ActiveSheet.ResetAllPageBreaks
End Sub
doesn't work. Do multiple columns mess it up?
Cells.PageBreak = xlPageBreakNone
col = 1
LastRw = 3300
For x = 1 To LastRw
If Cells(x, col).Value = "*dept*" Then 'or like "*dept*"
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Rows(x)
End If
Next
ActiveWindow.View = xlPageBreakPreview
'ActiveSheet.ResetAllPageBreaks
End Sub