Figure 25-2.
The VBA code for the Excel spreadsheet.