Odd and even

  • Thread starter Francis Hookham
  • Start date
F

Francis Hookham

I need to determine whether x is odd or even in a macro

= MOD(x, 2) works in a spreadsheet but

If MOD(x,2) = 1 then
etc

does not seem to work in a macro

Do you have any suggestions

Francis Hookham
 
K

Ken Johnson

Hi Francis,
In a macro x Mod 2 = 0 should be True when x is even.
Ken Johnson
 
J

JE McGimpsey

Francis Hookham said:
If MOD(x,2) = 1 then
etc

does not seem to work in a macro

Do you have any suggestions

There are a number of examples of VBA's Mod operator in VBA Help ("Mod
Operator")
 
F

Francis Hookham

Thanks ­ I should have checked out how MOD is used in Macro as opposed to
spreadsheet
 

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