Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Count number of HPageBreaks on worksheet - examples

No question here, just 1 function and 2 procedures for the archive.

Seach keywords/phrases:
Count the number of manual and horizontal page breaks in a worksheet.
Get the number of HPageBreaks in a worksheet.


Function PageBreaksHrzCount(SheetName As String) As Long

'Counts the number of horizontal page breaks in target wsheet
'both manual and automatic
PageBreaksHrzCount = Worksheets(SheetName).HPageBreaks.Count

End Function


Sub PageBreaksHCountM()

'Counts the number of manual horizontal page breaks on the
'active worksheet.

Dim HPB As HPageBreak
Dim N As Long
For Each HPB In ActiveSheet.HPageBreaks
If HPB.Type = xlPageBreakManual Then
N = N + 1
End If
Next HPB
MsgBox "There are " & N & " manual page breaks on this worksheet"

End Sub



Sub PageBreaksHCountMA()

'Counts the number of horiztonal manual & auto page breaks on the
'active worksheet.
Dim HBreaksCount As Integer
HBreaksCount = ActiveSheet.HPageBreaks.Count
MsgBox "There are " & HBreaksCount & " manual and automatic page
breaks on this sheet"

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 to count number of pages in worksheet msnews Excel Worksheet Functions 9 May 7th 14 12:26 PM
how to count number of pages in worksheet msnews Excel Discussion (Misc queries) 8 April 11th 08 02:39 PM
How can I count the number of ranges in a worksheet consolidation kuma-kami Excel Worksheet Functions 0 March 7th 07 05:34 AM
how do i count the number of times criteria appears in a worksheet MarkWatson Excel Worksheet Functions 2 August 1st 06 07:09 AM
Where are the examples from Help to copy to a blank worksheet? Beanbabeehoohoo Excel Discussion (Misc queries) 1 May 18th 06 10:10 AM


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