View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mekinnik Mekinnik is offline
external usenet poster
 
Posts: 159
Default function question??

Can a function call another function? Here is the function I have. I am tring
to apply a page break (which works fine) then tring to call my format page
funtion after it applies the page break??

Sub setPage()
Dim iRow As Long
Dim myCell As Range
Dim myRng As Range
Dim wks As Worksheet
Dim searchFor As String

searchFor = FrmCreate.CbxDept.Text
Set wks = Worksheets(searchFor)
With wks
.ResetAllPageBreaks
Set myRng = Nothing
On Error Resume Next
Set myRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
On Error GoTo 0

If myRng Is Nothing Then
MsgBox "No visible cells!"
Exit Sub
End If

iRow = 0
For Each myCell In myRng.Cells
iRow = iRow + 1
If iRow 1 Then
If iRow Mod 19 = 1 Then
.HPageBreaks.Add befo=myCell
Call FormatHeaders
End If
End If
Next myCell
End With

End Sub