Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Hi TheI am generating an excel report. In a single excel sheet, I have 6 data sets from 6 tables. I want to put only 2 data sets per page. After this 2 data set, I need a page break at row no3 after the last data cell in that data area(2nd set data). Each data set has a common word "J/J" in top line. this I will find(). How ca I give a page break. I tried this code but not working. -------- sub pgbreak() ActiveSheet.ResetAllPageBreaks Columns("A:A").Select rend = Cells(Rows.Count, "A").End(xlUp).Row For i = 1 To rend Set fndrng = Selection.Find(what:="ami", After:=ActiveCell) If Not fndrng Is Nothing Then j = j + 1 Cells(fndrng.Row, 1).Activate r = ActiveCell.End(xlDown).Row i = r If (j = 2) Then ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=Cells(r + 3, 1) j = 0 End If Else Exit Sub End If Next i End Sub I am getting an error looping several times. How can I simplify the code? Thanks in advance. -- jesmin ------------------------------------------------------------------------ jesmin's Profile: http://www.excelforum.com/member.php...o&userid=29540 View this thread: http://www.excelforum.com/showthread...hreadid=494411 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
cannot insert page break | Excel Discussion (Misc queries) | |||
Can't delete a page break | Excel Discussion (Misc queries) | |||
Want Excel to break links between worksheets in same file | Excel Worksheet Functions | |||
shortening a forumula | Excel Discussion (Misc queries) | |||
content does not stay in page break | Excel Worksheet Functions |