#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 390
Default Page Break

I have an excel spreadsheet, that I need the page to break when Column A is
not null, after considering the repeated row in the top.

Header1 Header2 Header3
1233454 AAAA $5000
CCCC
______________________
548789 DDDD $1000
KKKK

I want the page to break at the line above. We cant use the pivot table as
its only pulling top raw.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Page Break

Sub InsertBreak_At_Change()
Dim i As Long
For i = Columns(1).Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 13 Dec 2007 12:32:00 -0800, Max wrote:

I have an excel spreadsheet, that I need the page to break when Column A is
not null, after considering the repeated row in the top.

Header1 Header2 Header3
1233454 AAAA $5000
CCCC
______________________
548789 DDDD $1000
KKKK

I want the page to break at the line above. We cant use the pivot table as
its only pulling top raw.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 390
Default Page Break

It gives me a debug error :If Selection(i).Row = 1 Then Exit Sub


"Gord Dibben" wrote:

Sub InsertBreak_At_Change()
Dim i As Long
For i = Columns(1).Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 13 Dec 2007 12:32:00 -0800, Max wrote:

I have an excel spreadsheet, that I need the page to break when Column A is
not null, after considering the repeated row in the top.

Header1 Header2 Header3
1233454 AAAA $5000
CCCC
______________________
548789 DDDD $1000
KKKK

I want the page to break at the line above. We cant use the pivot table as
its only pulling top raw.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Page Break

Yes, it will if not started from row1

For now, this works with no error.

Sub InsertBreak_At_Change()
Dim i As Long
Range("A1").Select
For i = Columns(1).Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord

On Thu, 13 Dec 2007 13:11:00 -0800, Max wrote:

It gives me a debug error :If Selection(i).Row = 1 Then Exit Sub


"Gord Dibben" wrote:

Sub InsertBreak_At_Change()
Dim i As Long
For i = Columns(1).Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 13 Dec 2007 12:32:00 -0800, Max wrote:

I have an excel spreadsheet, that I need the page to break when Column A is
not null, after considering the repeated row in the top.

Header1 Header2 Header3
1233454 AAAA $5000
CCCC
______________________
548789 DDDD $1000
KKKK

I want the page to break at the line above. We cant use the pivot table as
its only pulling top raw.




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 390
Default Page Break

Thank you. I worked just fine.

"Gord Dibben" wrote:

Yes, it will if not started from row1

For now, this works with no error.

Sub InsertBreak_At_Change()
Dim i As Long
Range("A1").Select
For i = Columns(1).Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord

On Thu, 13 Dec 2007 13:11:00 -0800, Max wrote:

It gives me a debug error :If Selection(i).Row = 1 Then Exit Sub


"Gord Dibben" wrote:

Sub InsertBreak_At_Change()
Dim i As Long
For i = Columns(1).Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 13 Dec 2007 12:32:00 -0800, Max wrote:

I have an excel spreadsheet, that I need the page to break when Column A is
not null, after considering the repeated row in the top.

Header1 Header2 Header3
1233454 AAAA $5000
CCCC
______________________
548789 DDDD $1000
KKKK

I want the page to break at the line above. We cant use the pivot table as
its only pulling top raw.






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 390
Default Page Break

The code is working properly but where I have values start next to each other
within column A (Group A - start from A5 that has only one row, Group B -
start from A6)

I need to see the page break between A5 and A6.

Again, Groups that have multiple rows shows up page break properly and
working just fine.

Please provide your suggession/comments.

Thanks.

"Gord Dibben" wrote:

Yes, it will if not started from row1

For now, this works with no error.

Sub InsertBreak_At_Change()
Dim i As Long
Range("A1").Select
For i = Columns(1).Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord

On Thu, 13 Dec 2007 13:11:00 -0800, Max wrote:

It gives me a debug error :If Selection(i).Row = 1 Then Exit Sub


"Gord Dibben" wrote:

Sub InsertBreak_At_Change()
Dim i As Long
For i = Columns(1).Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 13 Dec 2007 12:32:00 -0800, Max wrote:

I have an excel spreadsheet, that I need the page to break when Column A is
not null, after considering the repeated row in the top.

Header1 Header2 Header3
1233454 AAAA $5000
CCCC
______________________
548789 DDDD $1000
KKKK

I want the page to break at the line above. We cant use the pivot table as
its only pulling top raw.




  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 390
Default Page Break

The code is working properly but where I have values within column A starting
from A5 and has only 1 row for the entire group and next group start at A6, I
need to see the page break between A5 and A6.

Example:

Header1(ColumnA) Header2 (ColumnF)
Cell # 5 10/01/2007
------------------------------------------------
Cell # 6 11/01/2007

Groups that have multiple rows show up page break properly with the current
code but in addition to that I need to see the page break between Cell # A5
and A6 as they are different groups.

Please provide your suggession/comments.

Thanks.


"Gord Dibben" wrote:

Yes, it will if not started from row1

For now, this works with no error.

Sub InsertBreak_At_Change()
Dim i As Long
Range("A1").Select
For i = Columns(1).Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord

On Thu, 13 Dec 2007 13:11:00 -0800, Max wrote:

It gives me a debug error :If Selection(i).Row = 1 Then Exit Sub


"Gord Dibben" wrote:

Sub InsertBreak_At_Change()
Dim i As Long
For i = Columns(1).Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 13 Dec 2007 12:32:00 -0800, Max wrote:

I have an excel spreadsheet, that I need the page to break when Column A is
not null, after considering the repeated row in the top.

Header1 Header2 Header3
1233454 AAAA $5000
CCCC
______________________
548789 DDDD $1000
KKKK

I want the page to break at the line above. We cant use the pivot table as
its only pulling top raw.




  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Page Break

Post a sample of your data like you did for your first post because I can't get
a picture from this description.


Gord

On Fri, 14 Dec 2007 07:49:03 -0800, Max wrote:

The code is working properly but where I have values start next to each other
within column A (Group A - start from A5 that has only one row, Group B -
start from A6)

I need to see the page break between A5 and A6.

Again, Groups that have multiple rows shows up page break properly and
working just fine.

Please provide your suggession/comments.

Thanks.

"Gord Dibben" wrote:

Yes, it will if not started from row1

For now, this works with no error.

Sub InsertBreak_At_Change()
Dim i As Long
Range("A1").Select
For i = Columns(1).Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord

On Thu, 13 Dec 2007 13:11:00 -0800, Max wrote:

It gives me a debug error :If Selection(i).Row = 1 Then Exit Sub


"Gord Dibben" wrote:

Sub InsertBreak_At_Change()
Dim i As Long
For i = Columns(1).Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 13 Dec 2007 12:32:00 -0800, Max wrote:

I have an excel spreadsheet, that I need the page to break when Column A is
not null, after considering the repeated row in the top.

Header1 Header2 Header3
1233454 AAAA $5000
CCCC
______________________
548789 DDDD $1000
KKKK

I want the page to break at the line above. We cant use the pivot table as
its only pulling top raw.





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 do page breaks when view menu doesnt page break preview HeatherF55 Excel Discussion (Misc queries) 0 September 21st 07 04:24 AM
Remove big gray page number on Page Break Preview??? annafred Excel Discussion (Misc queries) 1 January 9th 07 02:28 AM
change and/or remove page number watermark in page break preview juga Excel Discussion (Misc queries) 2 December 25th 06 10:15 AM
Hiding the page number in page break preview background. I need coffee, wake me up! Excel Discussion (Misc queries) 0 May 15th 06 10:32 AM
adding a new page break to an existing page break Edward Letendre Excel Discussion (Misc queries) 1 March 6th 05 09:29 AM


All times are GMT +1. The time now is 01:12 AM.

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"