View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default break page based on specific conditions

Hi,

This looks for a lower case 'a' in column A and inserts a page break after
every one.

Right click your sheet tab, view code and paste this in

Sub stance()
lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
For x = 2 To lastrow
If Cells(x - 1, 1).Value = "a" Then
HPageBreaks.Add Befo=Cells(x, 1)
End If
Next
End Sub

Mike

"Amarjeey" wrote:

Hi,

Could anyone let me know how can i use page break based on specific
conditions? I need macro for this. For example, search for table in A1
column, wherever table word will found it should start new page break.

Please help me on this regards. Thanks.
--
Amarjeet Kr. Sahay