MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Sort where a selected cell is preserved

  Asked By: Claude    Date: Mar 19    Category: MS Office    Views: 546

I developed an enhanced-sort macro which preserves the before-sort
selected cell, after the sort. That is to say that the data in the
selected cell after the sort is the same as it was before the sort.
The selection "follows" along with the sort.
I did this originally in a resource management spreadsheet. When
working on one resource, it is nice to sort in various ways, but keep
a given (selected) resource (cell) on the screen.

I put together a demo with extra comments. My implementation may not
be elegant, but works swell.

The algorithm (seemed obvious to me) is simply to temporately put a
"never-to-occur" value in the selected cell, then Find that data after
the sort and restore the original data. When the selected cell is in
the sort-key column (the sort would be messed up by the substitution),
the cell to its right is used instead. Oh yes, the rows are sorted
in the demo.



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on Sort where a selected cell is preserved Or get search suggestion and latest updates.