Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default insert page breaks every 43 lines

the code below works to transpose data to a sheet called "All".

however, i've tried several ways of inserting pagebreaks for every 43
rows of transposed data on sheet "All".

any suggestions?

thanks,
chase


Public Sub TransposeToOneColumn()
Dim sourceSht As Worksheet
Dim destSht As Worksheet
Dim destRow As Long
Dim cell As Range
Dim Counter As Integer

Worksheets("All").ResetAllPageBreaks

Application.ScreenUpdating = False

Set sourceSht = Worksheets("Projects")
Set destSht = Worksheets("All")
destRow = 1

For Each cell In sourceSht.Range("A4:A" & Range("A" & _
Rows.Count).End(xlUp).Row)

cell.Resize(, 43).Copy
destSht.Range("B" & destRow).PasteSpecial Transpose:=True

sourceSht.Range("A2:AQ2").Copy
destSht.Range("A" & destRow).PasteSpecial Transpose:=True

destRow = destRow + 43

Next cell

Sheets("All").Activate
Columns("B:B").Select
Selection.ColumnWidth = 55
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlTop
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Columns("A:A").Select
Selection.ColumnWidth = 32
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlTop
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Rows(44).PageBreak = xlManual

Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default insert page breaks every 43 lines

Chase,

try

Dim x As Long
Dim lrow As Long

lrow = Cells(Rows.Count, "A").End(xlUp).Row
x = 0
Do Until x lrow
x = x + 44
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=Rows(x)
Loop

steve

"chase" wrote in message
om...
the code below works to transpose data to a sheet called "All".

however, i've tried several ways of inserting pagebreaks for every 43
rows of transposed data on sheet "All".

any suggestions?

thanks,
chase


Public Sub TransposeToOneColumn()
Dim sourceSht As Worksheet
Dim destSht As Worksheet
Dim destRow As Long
Dim cell As Range
Dim Counter As Integer

Worksheets("All").ResetAllPageBreaks

Application.ScreenUpdating = False

Set sourceSht = Worksheets("Projects")
Set destSht = Worksheets("All")
destRow = 1

For Each cell In sourceSht.Range("A4:A" & Range("A" & _
Rows.Count).End(xlUp).Row)

cell.Resize(, 43).Copy
destSht.Range("B" & destRow).PasteSpecial Transpose:=True

sourceSht.Range("A2:AQ2").Copy
destSht.Range("A" & destRow).PasteSpecial Transpose:=True

destRow = destRow + 43

Next cell

Sheets("All").Activate
Columns("B:B").Select
Selection.ColumnWidth = 55
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlTop
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Columns("A:A").Select
Selection.ColumnWidth = 32
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlTop
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Rows(44).PageBreak = xlManual

Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default insert page breaks every 43 lines

Steve,

works great. MUCHISIMAS GRACIAS!
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
Excel: how to insert page breaks between all the rows at once? Kim Excel Discussion (Misc queries) 1 June 25th 08 09:37 PM
How do I insert page breaks in .txt for use in excel? JohnK Excel Discussion (Misc queries) 2 January 19th 07 11:24 PM
Insert Multiple Page Breaks heater Excel Worksheet Functions 1 September 13th 06 10:35 PM
In Excel, how can I keep 2 lines together when page breaks to 2nd Calvin Baisley Excel Discussion (Misc queries) 1 September 4th 06 02:02 AM
Can I set an automatic page breaks to break every 40 lines? Kennbu Excel Discussion (Misc queries) 1 June 15th 06 05:59 PM


All times are GMT +1. The time now is 05:54 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"