ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Page 1 to Page 2 (https://www.excelbanter.com/excel-programming/423071-page-1-page-2-a.html)

Stanley Braverman

Page 1 to Page 2
 

I am having a problem with the splitting order. If I use 50 rows per
page
Then the split and sorting order is ok. But if I want 42 rows per
page or any other amount then
The splitting order is out of proper sort.

In other words:
Page 1 plus page 2 now equals page 1
Then after moving up cleared cells
Page 2 and page 3 now equals page 2 (formally page 3 and 4)
Then after moving up cleared cells
Page 3 and page 4 now equals page 3 (formally page 5 and
6)etc..etc.etc
What needs to be changed to accomadate the different page sizes.

Thanks


Sub Move_Sets_PBreak()
Dim iSource As Long
Dim iTarget As Long

ISource= 1
ITarget= 1
Do
Cells(iSource, "A").Resize(50, 5).Cut _
Destination:=Cells(iTarget, "A")
Cells(iSource + 50, "A").Resize(50, 5).Cut _
Destination:=Cells(iTarget, "f")
ISource= iSource + 100
ITarget= iTarget + 50
PageBreak = xlPageBreakManual
Loop Until IsEmpty(Cells(iSource, "A").Value)

End Sub






Stanley Braverman

Page 1 to Page 2
 
Problem Solved thanks to Gord.

"Stanley Braverman" wrote in message
...

I am having a problem with the splitting order. If I use 50 rows per
page
Then the split and sorting order is ok. But if I want 42 rows per
page or any other amount then
The splitting order is out of proper sort.

In other words:
Page 1 plus page 2 now equals page 1
Then after moving up cleared cells
Page 2 and page 3 now equals page 2 (formally page 3 and 4)
Then after moving up cleared cells
Page 3 and page 4 now equals page 3 (formally page 5 and
6)etc..etc.etc
What needs to be changed to accomadate the different page sizes.

Thanks


Sub Move_Sets_PBreak()
Dim iSource As Long
Dim iTarget As Long

ISource= 1
ITarget= 1
Do
Cells(iSource, "A").Resize(50, 5).Cut _
Destination:=Cells(iTarget, "A")
Cells(iSource + 50, "A").Resize(50, 5).Cut _
Destination:=Cells(iTarget, "f")
ISource= iSource + 100
ITarget= iTarget + 50
PageBreak = xlPageBreakManual
Loop Until IsEmpty(Cells(iSource, "A").Value)

End Sub









All times are GMT +1. The time now is 02:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com