Hi all,
Quick Questions. I was looking up Subs on the internet and found this code.
Sub computeArea(ByVal length As Double, ByVal width As Double)
' Declare local variable.
Dim area As Double
If length = 0 Or width = 0 Then
' If either argument = 0 then exit Sub immediately.
Exit Sub
End If
' Calculate area of rectangle.
area = length * width
' Print area to Immediate window.
Debug.WriteLine(area)
End Sub
The "Exit Sub" in the middle of the code, does it exit from the "IF" statement it is in, or the entire "Sub computerArea()?" If it only exits the if statement, how can I make it exit the entire "Sub computerArea()" because I have a code that needs to be exited when the if statemet (in the middle of my code)is true.
Thank you for your time
Bookmarks