Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]() Hello All, I have this macro, it page breaks pages however, due to the large number of pages I get an error "RUN TIME ERROR 1004". That happens because the page breaks exceed 1026 pages. Is there anyway to make the macro stop once it reaches 1026 pages? Thanks, Nawaf Sub STEP3() Application.Wait Now + TimeValue("00:00:03") Dim Curr_Base As Long Dim Prev_Base As Long Dim i As Long Dim Loop_Count As Long ActiveWindow.Activate Loop_Count = Range(Selection, Selection.End(xlDown)).Count 'MsgBox Loop_Count For i = 3 To Loop_Count Range("E" & i).Select Curr_Base = ActiveWindow.ActiveCell 'MsgBox Curr_Base If (Curr_Base < Prev_Base) Then ActiveWindow.SelectedSheets.HPageBreaks.Add befo=ActiveCell End If Prev_Base = Curr_Base Next i End Sub -- countryfan_nt ------------------------------------------------------------------------ countryfan_nt's Profile: http://www.excelforum.com/member.php...o&userid=11051 View this thread: http://www.excelforum.com/showthread...hreadid=376839 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
time differences in a column | Excel Worksheet Functions | |||
Time Sheet Calculation Help Needed! | Excel Worksheet Functions | |||
Time Sheets | Excel Discussion (Misc queries) | |||
unmet challenge | Excel Worksheet Functions | |||
time formatting and time categorizing (vlookup or data validation) | Excel Worksheet Functions |