Проверка числа на чётность
Public Function IsEven(lNumber As Long) As Boolean
IsEven = Not lNumber Mod 2 = 1
End Function
Ещё вариант (потяжелее)
Public Function IsEven(vNumber As Variant) As Boolean
Dim n As Integer
On Error GoTo IsEven_Err
n = CInt(vNumber)
IsEven = Not n Mod 2 = 1
IsEven_Err:
IsEven = False
Err.Clear
End Function
|