![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 05:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com