PDA

View Full Version : Sorting, even-odd



dasnoob
05-31-2011, 10:35 AM
Hi!

I'd have to do ha macro which collects 10 numbers from the user and then sort the numbers (in the marked cells) in a way that all the even numbers comes first, and the odd ones after.

Could somebody please help me?

Chabu
05-31-2011, 01:37 PM
hey dasnoob,

you really have to try things first :-)
use the help I gave you in your previous question. Put the even numbers in one array, the uneven ones in another (use check on remainder of mod 2 ( search for "mod" in the help )) to put the number in one of both arrays.
Then sort the arrays.

Try it out and post your code if you get stuck

Greetings

GTO
05-31-2011, 05:19 PM
Cross-posted: http://www.thecodecage.com/forumz/members-excel-vba-programming/208993-sort-even-odd.html

mikerickson
05-31-2011, 06:31 PM
dasnoob,
Welcome to VBA Express.

Would you please read this link. How to Cross Post (http://www.excelguru.ca/node/7)

It explains why we, like almost every other Excel forum, require that if you cross-post (post the same question in two forums) that you provide a link to the other forum.

Thanks.