Designing the Utility

To keep our utility relatively simple, we will implement the following selection criteria:

• Select cell if preceding cell is different

• Select cell if preceding cell is the same

• Select empty cells

• Select nonempty cells

The search range for the selection operation, that is, the area to which the selection criteria will be applied, is the current selection on the active worksheet. Note that we will need to verify that this is a selection of worksheet cells and not, say, a chart. For the first two criteria, this range must be either a single row or a single column or a portion thereof. For the last two criteria, the search range can be any selection of cells.

As a courtesy to the user, if the current selection is just a single cell, the utility will default to the used range for the last two criteria (empty or nonempty) and to the used portion of the column containing the active cell for the first two criteria (same and different).

As a bonus, we also include a feature that enlarges the current selection by including the entire row (or column) containing each selected cell. For instance, applying this to the worksheet in Figure 19-28 will select rows 12, 16, 18, 23, and 25.

0 0

Post a comment