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

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: