vba check if variable is whole number
'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
Source: academy.excelhero.com