Function Convert Values Class

CIntIgnErr

"Convert To Integer Ignore Errors" Attempt to convert vValue to an Integer value. Return vValue as an Integer value if the conversion was successful. Return 0 (zero) if vValue could not be converted to an Integer.

Signature (Visual Basic / VBA)

Public Function CIntIgnErr( _
    ByVal vValue As Variant _
    ) As Integer

Code Example

    CIntIgnErr(34) = 34%
    CIntIgnErr(0) = 0%
    CIntIgnErr(-34) = -34%
    CIntIgnErr(34.3) = 34%
    CIntIgnErr(123456) = 0%
    CIntIgnErr("1") = 1%
    CIntIgnErr("0") = 0%
    CIntIgnErr(#12/31/1899#) = 1%
    CIntIgnErr("Word") = 0%

Parameters

Parameter Description
vValue The value which will be converted to an Integer and returned (if conversion is possible). Conversion is not possible if vValue is Null, an Error, an Object, a non-numeric String, or a numeric value out of the range allowed for this data type.