Function Convert Values Class

BlankToValue

Replace Empty, Null, and empty String values with some other value. Leave all other types of values unchanged.

Signature (Visual Basic / VBA)

Public Function BlankToValue( _
      ByVal vValue As Variant _
    , ByVal vReplace As Variant _
    ) As Variant

Code Example

    BlankToValue("", "NONE") = "NONE"
    BlankToValue(Null, "NONE") = "NONE"
    BlankToValue("Word", "NONE") = "Word"
    BlankToValue(Null, 456) = 456
    BlankToValue(123, 456) = 123

Parameters

Parameter Description
vValue The value which is to be replaced in certain limited cases. Function returns vReplace is vValue is Empty, Null, or an empty string. Function returns vValue unchanged in all other cases.
vReplace The value which is to replace that of vValue in certain cases.