Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Lewis Evans   on Feb 04 In MS Office Category.

  
Question Answered By: Jonathan Harrison   on Feb 04

I would do something like this:



Sub First()

For cnt = 1 To 5

k = k + 1

If Second(k) Then

Exit Sub

End If

Debug.Print "k--" & k

Next cnt

End Sub



' Change this to a Function instead of Sub.

' Return True when we should exit  both functions.

Function Second(ByVal u As Single) as Boolean

If u = 3 Then

Second = True

Exit Function 'Exit Second procedure

End If

Debug.Print "u--" & u

Second = False ' This line is not necessary in VBA

' ...because False would be the default return value anyway.

' ...(This is not the case in future VB versions...)

End Function

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Exist Sub altogether Or get search suggestion and latest updates.


Tagged: