Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
odd or even number
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
odd or even number
Maileen ,
(myInt MOD 2) = 1 gives true for an odd number, false for an even -- HTH Bob Phillips "Maileen" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
odd or even number
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 -- Regards Ron de Bruin http://www.rondebruin.nl "Maileen" wrote in message ... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
odd or even number
thanksa lot.
it works great. Bob Phillips wrote: Maileen , (myInt MOD 2) = 1 gives true for an odd number, false for an even |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sumif number is greater than a number but less than another number | Excel Discussion (Misc queries) | |||
How can I click on a telephone number in an Excel 2002 spreadsheet, and have the number dialed? | Excel Discussion (Misc queries) | |||
How to calculate number of occurencies of a specific number number | Excel Discussion (Misc queries) | |||
excel format cells/Number/Category: Number problem | Excel Discussion (Misc queries) | |||
Rounding a number to a multiple quantity that adds to a fixed total number | Excel Worksheet Functions |