VBA Periksa apakah variabel adalah seluruh bilangan

'Two different ways to check if a double is assigned a whole number:

Function IsWholeNumber(n#) As Boolean
    IsWholeNumber = 0 = InStr(n, ".")
End Function

Function IsWholeNumber(n#) As Boolean
    IsWholeNumber = n = Int(n)
End Function

-------------------------------------------------------------

MsgBox IsWholeNumber(123)         '<---displays: True
MsgBox IsWholeNumber(123.001)     '<---displays: False


Excel Hero