Hello everyone,

I want to apply 2 changes to an Excel spreadsheet, in this specific order, and despite hard search here and in Google, I haven't found a solution yet:

1. The first thing I want to do is to order certain rows values (numbers, in this case), i. e. order the cells horizontally, from left to right. I already found a simple solution like this one ( http://www.tech-recipes.com/rx/3691/...-to-sort-rows/ ), but this only selects one row each time, and I want to apply it simultaneously to dozens or even hundreds of rows, that aren't sequential. The layout of the rows I want to sort the spreadsheet is something like the 8th row, then the 12th, and then a pattern appears (the 15th, 18th, 21st, (...) rows or, simply put, every 3rd row beginning from the 12th). Regarding selecting the "nth" row, I found this: http://www.lytebyte.com/2009/06/02/h...-row-in-excel/

So, I think a macro is the only way out of this. I found this thread ( http://www.excelforum.com/excel-new-...s-columns.html ), but it's intended to sort multiple contiguous rows, so it's a different case.

Using the code from that thread, I would be starting from this:

Please Login or Register  to view this content.
2. Concerning the same range of cells mentioned in point 1, I want to change their values. The original values are integers, ranging from 1 to 8, for instance, and I want to keep 1 and 2, and change 3 to 1, 4 to 2, 5 to 1, 6 to 2, 7 to 1 and finally 8 to 2. I have been advised to use the VLOOKUP function ( http://officeimg.vo.msecnd.net/en-us...F101984660.pdf ), but
it seems (again) that this only applies to contiguous rows. Am I wrong?

I don't know if I'm being sufficiently clear explaining myself. By the way, I'm using Excel 2007.

If anyone could help me, I would be deeply appreciated.

Thanks,
Joćo