Felix, I don't understand the question. You can sort the data in a worksheet based on the data in one column (D or whatever), but what do you mean by a "code"?
Wait, maybe the key word here is "automatically". Are you hoping for a way to tell a worksheet to resort itself, even after you've made changes to it? I suppose that's possible. But I've never heard of anyone trying to do it; the usual way is to make your changes to the worksheet, then re-sort the data manually.
I've never tried it, but I guess you could write a program that is automatically executed every time you make a change to that worksheet. The program would first check to see whether any of the changes you'd made are in column D (or whatever column you're sorting on), and if that column is involved then do the sort. Seems to me that would be disruptive, though; you'd insert a new row, say, with a new value in col D, and instantly the row would be snatched away from your view and reappear somewhere else in the worksheet according to its sort value. I don't think I'd like it.
|