Solved EXCEL MACRO: Sorting columns and transposing

November 24, 2011 at 01:00:59
Specs: Windows XP
Does anyone know how to do this please?
• Column.A (A1 to A9) contains the result of function RAND().
• Column.B contains the number 01 to 09.
• Columns(“A:B”) sorted (ascending) 99 times automatically.
• Upon each cycle, take the new sorted values from Column.B and place them next available Column as follows:
• 1st cycle, Column.C = Column.B
• 2nd cycle, Column.D = Columm.B
• 3rd cycle, Column.E = Columm.B
• and so on…

See More: EXCEL MACRO: Sorting columns and transposing

Report •

November 24, 2011 at 09:19:52
✔ Best Answer
Are you trying to create 99 sets of 1 - 9, with each set sorted randomly?

If so, it can be done without a macro.

In A1, enter this formula and drag it down to A9. Ignore the #N/A errors for now.


In A10, enter this formula and drag it down to A18:


A1:A9 should now contain a random set of 1 - 9

Now, select A1:A18 and drag it across to Column CU which will give you 99 sets of randomly sorted 1 - 9.

Note that since RAND() is volatile, each time the sheet recalculates you will get a different 99 sets of numbers. If you need to lock in a set, select A1:CU9 and do a Copy...PasteSpecial...Values.

You can actually put the RAND() function cells anywhere you want as long as you reference them correctly in the INDEX formula. In other words, you can "hide them" someplace else in the workbook if you want.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Report •

November 24, 2011 at 09:46:44
Fantastic, it works brilliantly.

You've made my day.

Thanks a million.

Report •

Related Solutions

Ask Question