NZ – Check whether a value is Null

NZ – Check whether a value is Null

' Check if a value is Null. If not it returns the value, ' otherwise it returns the ValIfNull argument, or zero/null string' if the second argument is omitted'' This function is patterned after the Access function with the same name.'-----------------------------------------------------------------'Date:          19 Feb 99'Developer:     Heather McCaslin'*****************************************************************Public Function NZ(CheckVar As Variant, Optional ValIfNull As Variant) As _    Variant    If IsNull(CheckVar) Then        If IsMissing(ValIfNull) Then            ' this translates to "" for strings, and 0 for numbers            NZ = Empty        Else            NZ = ValIfNull        End If    Else        NZ = CheckVar    End IfEnd Function

See also  How College Students Can Shape the Future of Tech Responsibility

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist