More testing

I was tempted to call it a day. However, just because the procedure worked with the Test.xlsx workbook didn't mean that it would work with all workbooks. To test it further, I loaded a few other workbooks and retried the routine. I soon discovered that the application was not perfect. In fact, it was far from perfect. I identified the following problems:

■ Workbooks with many sheets took a long time to sort because the screen was continually updated during the move operations.

■ The sorting didn't always work. For example, in one of my tests, a sheet named summary (all uppercase) appeared before a sheet named Sheet1. This problem was caused by the BubbleSort procedure - an uppercase U is "greater than" a lowercase h.

■ If Excel had no visible workbook windows, pressing the Ctrl+Shift+S shortcut key combo caused the macro to fail.

■ If the workbook's structure was protected, the Move method failed.

■ After sorting, the last sheet in the workbook became the active sheet. Changing the user's active sheet is not a good practice; it's better to keep the user's original sheet active.

■ If I interrupted the macro by pressing Ctrl+Break, VBA displayed an error message.

■ The macro cannot be reversed (that is, the Undo command is disabled). If the user accidentally presses Ctrl+Shift+S, the workbook sheets are sorted and the only way to get them back to their original order is by doing it manually.

0 0

Post a comment