NulltoInt
Nullだったら0、Null以外はInt型に変換
数値以外は0
VBAでのinteger型(-32,768 ~ 32,767)範囲を超えると
エラーでコケる
longとか、Currencyとか類似関数はその時に応じて作成

Function NulltoInt(ByVal vData As Variant) As Integer
Dim sData As String

sData = NulltoStr(vData)
If sData = "" Then
    NulltoInt = 0
Else
    If IsNumeric(sData) = True Then
       NulltoInt = CInt(sData)
    Else
       NulltoInt = 0
    End If
End If

End Function
2021.11.19 10:32 | pmlink.png 固定リンク | folder.png 関数

- CafeLog -