• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

sorting selected rows in a table

hi ,
Is it possible to sort some selected rows in a table.

eg say in the table i have
row 1 sl no date item
row 2 1 12/5/13 a
row 3 2 15/5/13 b
row 4 3 10/5/13 a
row 5 4 14/5/13 c

i have selected row 2 and row 4 and i want to sort these 2 rows in increasing order of date without affecting any other row.

How can this be done
 
This method also seems to work for me (XL2010)..

I converted my Data Table into the Range, Select the rows, and sort by the Variable you want to sort to, in this case when you have not selected headers, use the column value/text that is just above the field to be sorted. (in this case B8 or 126)

Samp;le.png
 
Hi, paramnayak!

If you haven't performed yet the search herein, try going to the topmost right zone of this page (Search...), type the keywords used in the title when creating the topic or other proper words and press Search button. You'd retrieve many links from this website, like the following one(s) -if any posted below-, maybe you find useful information and even the solution. If not please advise so as people who read it could get back to you as soon as possible.
http://chandoo.org/forum/threads/alphanumeric-sorting-solved.10611/#post-61366

In the procedure SortAColumn you'll find a generic sort routine, that you could adapt for your purposes in 2 ways:
a) If it's the case of a contiguous range of rows, like in Faseeh's example, you can change the For...Next loops range changing the 2 and lLast by 9 (1st row) and 15 (last row).
b) If the rows aren't adjacent you can use a helper column set in 0 for excluded rows and in 1 for included, and then:
- pass a new parameter piColumnFilter as Integer
- add an if clause at the beginning of the I For...Next loop to filter by .Cells(piColumnFilter, 1).value=1

Hope it helps.

Regards!
 
Back
Top