9-Jan-09: Smart Table Sorting using VBA

Nick's picture

This example sheet is one of my favourites... This version only works in XL 2007, but the same principles can work in 2003.

Suppose you have a normal table:
Data

Now suppose you need to change the sort order of the sheet all the time... that's quite a pain. This example sheet has code in the worksheet module that will sort the table whenever you click on a heading. The cunning part is that it toggles between ascending and descending, so all you have to do to reverse the order is to click off then on again.

This can save a huge amount of time !

IMPORTANT: This workbook contains VBA macros. If you're worried about SECURITY, open Excel in SAFE MODE first to view the code. If you're happy, then open Excel normally.

AttachmentSize
SortTable.xls40.5 KB