Return to VBA Code Examples

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.

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users! vba save as


Learn More!