odd or even number

M

Maileen

Hi,

In my form, i need to find if a number is odd or even.
How can i do it ?

ISODD or ISEVEN are only function from worksheet, but in my case, the
number that i have to test is the row of my listview.
so a simple INT variable.
thanks a lot.
Maileen
 
R

Ron de Bruin

Hi Maileen
You can use Mod in VBA

Sub test()
If ActiveCell.Value Mod 2 = 0 Then
MsgBox "Even"
Else
MsgBox "odd"
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top