View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson[_2_] Chip Pearson[_2_] is offline
external usenet poster
 
Posts: 95
Default Count the number of just the horizontal manual page breaks

Try something like the following:

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"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"DataFreakFromUtah" wrote in
message om...
Win 2000
Excel 2000

Hello,
I am trying to find a way to count just the number of manual
horizontal
page breaks in the active worksheet. The count should not

include
the number of automatic horizontal page breaks. I have a

procedure
below that gives me both (manual & automatic), but I can't find
a way to isolate for just the manual count.


I need to incorporate xlPageBreakManual into the procedure I

think,
but
I'm sure how to do this.
I would appreciate any help that could be provided.
Thank you so much.
Tom


Sub PageBreaksHCount()
'Counts the number of horiztonal page breaks (both manual &

automatic)
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