LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Manual Horizontal Pagebreak Report - an example

No question here, just a procedure for the archive.

Search terms: horizontal page break report, return pagebreak rows,
HPageBreaks report, pagebreaks report, page break location, manual
pagebreaks, summary of pagebreaks, row numbers


Create a new report worksheet that contains the row of numbers
of all MANUAL horizontal page breaks on the
active worksheet

Sub PageBreaksHorizontalReportMANUAL()
'Creates a new report worksheet that contains the row of numbers
'of all MANUAL horizontal pagebreaks on the
'active worksheet

Dim cell As Range
Dim PageBreakSheet As Worksheet
Dim TargetWorksheet As Worksheet
Dim hb As HPageBreak

Dim Row As Integer


On Error Resume Next

'Add a new worksheet
Application.ScreenUpdating = False
Set TargetWorksheet = ActiveWorkbook.ActiveSheet
Set PageBreakSheet = ActiveWorkbook.Worksheets.Add
PageBreakSheet.Name = "Pagebreaks in " & TargetWorksheet.Name

'Set up the column headings for Report worksheet
With PageBreakSheet
Range("A1") = "PageBreak Row"

'Optional 2nd reference that can be used to return
'a cells value that has the horizontal page break
Range("B1") = "PageBreak Cell Value"

Range("A1:B1").Font.Bold = True
End With

'Process each pagebreak
Row = 2

For Each hb In TargetWorksheet.HPageBreaks
If hb.Type = xlPageBreakManual Then
With PageBreakSheet
Cells(Row, 1).Value = hb.Location.Row

'Optional 2nd reference that can be used to return
'a cell's value that has the horizontal page break on
'it's row. 'In this case it takes the value in column A with
'the row number of the page break. Adjust
Cells(hb.Location.Row, #) as
'needed.

Cells(Row, 2).Value =
CStr(TargetWorksheet.Cells(hb.Location.Row, 1).Value)
Row = Row + 1
End With
End If
Next

'Adjust column widths on Report sheet
PageBreakSheet.Columns("A:B").AutoFit
Application.StatusBar = False

'Select a cell on the top of the report worksheet
Range("A2").Select

End Sub
 
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
Need formula or report to condense table, not by manual sort Copart Excel Discussion (Misc queries) 4 August 19th 09 08:23 PM
Cant move pagebreak in PageBreak View in Excel2003 Vasanthan Excel Worksheet Functions 1 August 22nd 07 03:28 PM
INSERT HORIZONTAL PAGEBREAK AFTER EACH LINE IN ENTIRE WORKSHEET . KNPALIA Excel Worksheet Functions 1 October 27th 06 05:46 PM
Count the number of just the horizontal manual page breaks DataFreakFromUtah Excel Programming 1 November 27th 03 03:59 PM
How to pagebreak Bilal A F Excel Programming 1 November 13th 03 06:57 PM


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

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

About Us

"It's about Microsoft Excel"