I'm trying to sort a selection. I've searched on google and all the hits want to sort the data in a selection, their headings are inaccurate. I want to sort the selection. So what's happening is my worksheet has lists of codes in columns. The user will select as many codes in as many columns as he desires (by using the control key and selecting cells wherever he wants). When I loop through the selection in VBA, I get the cells in the ORDER THAT THE USER SELECTED THEM. I need to process them in column order and then row order. My code that loops through the selection...
Dim cl As Range
For Each cl In Selection
MsgBox "Found cell "& cl.Address & "..."& cl.Value
Next cl
My question is...How do I get my loop to give me the cells in order of (cl.column, cl.row)?
More information... I have pasted an image of my spreadsheet below. They are CPI codelists from the ABS Webservice API, although this is not important. I used the snipping tool, and when I took the image the highlighting of the selected cells didn't show, so I highlighted them again in yellow after I took the image. The cells could possibly have been selected by the user in any order, but I need to process the selected cells by (column, row). The selected cells are not necessarily contiguous.