View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Need to read number of PrintTitleRows currently set

Hello Jim,

' RowsToRepeat() Function
' Oct 11, 2000 - Jim Cone - San Francisco, USA
' Returns the first row, last row or number of rows in
' "Rows to repeat at top" in"Page Setup".

'-------------------------------------------------------------------
Function RowsToRepeat(ByVal RowRequest As String) As Long
On Error GoTo ThatsAll
Dim TopRow As Long
Dim MidPoint As Long
Dim BottomRow As Long
Dim TitleString As String

TitleString = ActiveSheet.PageSetup.PrintTitleRows
If Len(TitleString) = 0 Then Exit Function 'RowsToRepeat will = 0
TitleString = WorksheetFunction.Substitute(TitleString, "$", vbNullString)
TopRow = Val(TitleString)
MidPoint = InStr(1, TitleString, ":", vbTextCompare)
BottomRow = Val(Mid$(TitleString, MidPoint + 1, 99))

Select Case RowRequest
Case "LastRow"
RowsToRepeat = BottomRow
Case "FirstRow"
RowsToRepeat = TopRow
Case Else
RowsToRepeat = BottomRow - TopRow + 1
End Select

Exit Function
ThatsAll:
Beep
RowsToRepeat = 0
End Function
'------------------------------


"Jim May" wrote in message
news:wpFme.21201$Fv.10134@lakeread01...
From my Immediate WIndow I get:
? ActiveSheet.PageSetup.PrintTitleRows
$1:$4
How can I get the integer 4 ?
TIA,
Jim