-
Hi there, i have created a new sub, and have put its one parameter set to optional, then in the procedure i test to see if the sub was passed the parameter or not, but on testing it, the ismissing( ) always return false even if nothing is passed to the sub. the parameter type is integer and it no value is passed it seem to get automatically assigned the value 0. Any ideas on what is happening here?
Thanks for any help, Piers
-
IsMissing uses variants. This may be what your problem is as you are checking an integer.
-
There is no need for ismissing if youre using optional but you have to set the integer default value:
Code:
Sub blabla(Optional argument As Integer = -1)
If argument = -1 Then
'code
Else
'code
End If
End Sub