#1   Report Post  
Posted to microsoft.public.excel.misc
DA DA is offline
external usenet poster
 
Posts: 104
Default Insert Page Break

hello
I was given the following macro for inserting page break. Somehow, I keep
getting the error: Can't execute code in break mode

What does the error mean and how can I fix it?
Thank you very much

Sub insert_Pbreak()
Dim oldval As String
Dim rng As Range
oldval = Range("a1")
For Each rng In Range("A1:a6000")
If rng.Text < oldval Then
rng.PageBreak = xlPageBreakManual
oldval = rng.txt
End If
Next rng
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Insert Page Break

From VBE on the Standard toolbar click the Reset button. This halts all macro
execution..and then try

If this post helps click Yes
---------------
Jacob Skaria


"da" wrote:

hello
I was given the following macro for inserting page break. Somehow, I keep
getting the error: Can't execute code in break mode

What does the error mean and how can I fix it?
Thank you very much

Sub insert_Pbreak()
Dim oldval As String
Dim rng As Range
oldval = Range("a1")
For Each rng In Range("A1:a6000")
If rng.Text < oldval Then
rng.PageBreak = xlPageBreakManual
oldval = rng.txt
End If
Next rng
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
DA DA is offline
external usenet poster
 
Posts: 104
Default Insert Page Break

I re-wrote the macro and it worked.

"da" wrote:

hello
I was given the following macro for inserting page break. Somehow, I keep
getting the error: Can't execute code in break mode

What does the error mean and how can I fix it?
Thank you very much

Sub insert_Pbreak()
Dim oldval As String
Dim rng As Range
oldval = Range("a1")
For Each rng In Range("A1:a6000")
If rng.Text < oldval Then
rng.PageBreak = xlPageBreakManual
oldval = rng.txt
End If
Next rng
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I insert a page break between every row and column? Ashley Excel Discussion (Misc queries) 2 February 26th 09 03:21 AM
INSERT ROW AND PAGE BREAK jcontrer Excel Discussion (Misc queries) 0 May 15th 08 07:09 PM
insert page break when there is a change in the row value [email protected] Excel Worksheet Functions 3 July 14th 06 07:20 PM
cannot insert page break tsmanz Excel Discussion (Misc queries) 2 December 5th 05 05:45 PM
Insert Page Break Don Excel Discussion (Misc queries) 3 June 9th 05 08:32 PM


All times are GMT +1. The time now is 11:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"