VBA IsMissing Function
IsMissing Description
Used to check if an optional argument to a procedure is missing.
Simple IsMissing Examples
Sub MyProcedure(Optional param)
If IsMissing(param) Then
MsgBox "Param is missing"
Else
MsgBox "Param is not missing"
End If
End Sub
For the procedure above, test the following codes.
Call MyProcedure
Result: “Param is missing”
Call MyProcedure("abc")
Result: “Param is not missing”
IsMissing Syntax
In the VBA Editor, you can type “IsMissing(” to see the syntax for the IsMissing Function:
The IsMissing function contains an argument:
VarName: the name of an optional variant procedure argument.