Excel97 - VBA to sort selected range
Posted on 2002-03-27
I would like to be able to run some VBA that would sort a range of data - I potentially may have several more columns of data I require sorting over and above Excel's standard 3 column sort. I know it is possible to overcome the 3 column sort limitation by performing sorts within sorts BUT it's a hassle.
What I would like is some VBA to do the following -
display a pop-up screen for the user to specify the data range.
The VBA would then sort the data (vertically) across columns left to right in ascending order.
Assume no header rows. The tricky bit is catering for different numbers of columns for the sort depending on the range selected. It would also be good if the user had the ability to return the data to its original unsorted state. I guess the best solution would be to offer the user the choice of overwriting the existing data or creating a new data range for the sorted data - this would remove the hassle of getting the data back to its original state.