multiple argument subs vba multiple argument subs vba vba vba

multiple argument subs vba


When using multiple arguments, you can either write:

 setInterest "myAccount", 3

Or

 Call setInterest("myAccount", 3)

In both examples you can name the arguments:

setInterest account:="myAccount", dmonth:= 3


I add this answer, for Why your syntax works with one argument ?

Public Sub setInterest(account As String)    '...somecode...End SubsetInterest ("myAccount")

Note :
When there is not any , between ( and ), VBA thinks it's a formula and exactly one argument.

When formula calculate the result will be like this:

Dim str As Stringstr = ("TEST")Debug.Print str[Output:]TEST