View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Wally Steadman[_4_] Wally Steadman[_4_] is offline
external usenet poster
 
Posts: 16
Default Using (what goes in here) for sub routine

Was reading the Excel Help on the Sub Statement and this is the example that
is shown:
' Sub procedure definition.
' Sub procedure with two arguments.
Sub SubComputeArea(Length, TheWidth)
Dim Area As Double ' Declare local variable.
If Length = 0 Or TheWidth = 0 Then
' If either argument = 0.
Exit Sub ' Exit Sub immediately.
End If
Area = Length * TheWidth ' Calculate area of rectangle.
Debug.Print Area ' Print Area to Debug window.
End Sub

I notice that the there is Lenght and TheWidth in the brackets after the sub
name. Am I correct in assuming that these have to be given values
somewhere? I notice in the sub routine they are not defined so I am
assuming they are definned elsewhere. I am trying to learn about the
arguments that can go in that set of brackets after the sub name to further
my knowledge. I see things like Sub Name(ByVal etc...) and was trying to
figure out the whens and whys of using that and where is that stuff defined
as I cannot find it in the help when I do a search for ByVal etc....

Thanks in Advance and have a Happy New Year everyone

Wally Steadman