Hi esoterick,
If you record a new macro, Excel will create cod for specific range of cells that you selected when you did the "demo". All you have to do afterwards is edit the code to make it more generic and youre away.
Below is some demo macro that you might be able to edit.
1) Open visual basic editor by going tools ---> Macro ---> Visual basic editor. Copy and paste the code below into a new module (Insert ---> Module)
2) The macro assumes that the data to be sorted starts in row 4 for all columns and ends before row 100 in all columns, you might need to change this.
3) I have assumed that your data starts in column 1 ( = "A") to be sorted and ends in column 199 (whatever that is!), and it is to be sorted in pairs as per your post.
4) You then look up the reference cells for your selection which are the top-left-most cell and the bottom-right most cell in the pair of columns and get their address, and get the top-right-most cell address because this sets the column you are going to sort by.
5) Your sheet needs to be called "Sheet1" and if it is not you need to replace all instances of sheet1 in the code below.
6) I have done a sort based on the second collumn in each pair, ascending assuming their is no header row. You might need to replace the line starting with "Selection.Sort K...." etc with whatever your recorded macro gives.
7) To run the macro close the visual basic editor and go Tools ---> Macro ---> Macros... Then pick "sortstuff" from the list and click run, and you should be in business.
Id make sure you save the workbook before running the code, just in case is screws stuff up!
Good luck,
P
Bookmarks