View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default Insert Page Break After Partial Text Match

I think this will do what you want:
Sub pagebreak()
Dim value1 As String

Range("A1").Select
For Each Cell In Columns("A").SpecialCells(xlCellTypeConstants)

If Cell.Value Like "*Total*" Then
ActiveCell.EntireRow.Select
ActiveWindow.SelectedSheets.HPageBreaks.Add ActiveCell.Offset(1, 0)
Else
End If

ActiveCell.Offset(1, 0).Select
Next
End Sub

HTH!!

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"samcham" wrote:

Column A looks like this:

01.6000
01.6000
01.6000
01.6000
01.6000
01.6000
01.6000

Department A Total

01.6010
01.6010
01.6010

Department B Total

I need a macro to insert a horizontal page break AFTER each line where the
word "Total" appears in column A.

Any ideas??

- I'm not a programmer, just a user. So, I need rather explicit
instructions! ;-)