Example Selecting Special Cells

The Excel user interface does not have a built-in method for selecting worksheet cells based on various criteria. For instance, there is no way to select all cells whose value is between 0 and 100, or all cells that contain a date later than January 1, 1998. There is also no way to select only those cells in a given column whose value is different from the value of the preceding cell. This can be very useful when you have a sorted column and want to extract a set of unique values, as shown in Figure 19-28.

Figure 19-28. Selecting unique values

12

Denver

13

Denver

14

Denver

15

Denver

16

Lo£ Angeles_1

17

Lot Angela

18

New Vork

19

New Vork

20

New York

21

New York

22

New Vork

23

Port and

24

Portland

Soatllo

26

Se-aHle

We will develop a small utility (and add it to the SRXUtils application) that can make a selection based on some simple criteria. You may want to enhance this utility by adding more criteria.

The first step is to augment the DataSheet for SRXUtils by adding a new row for the new utility, as shown in Figure 19-29. (The order of the rows in this DataSheet is based on the order in which we want the items to appear in the custom menu.)

Figure 19-29. Augmenting

f. I e t-

1

mit

GrAiTtoii PrK

PrKMbn

InWcta-ioli

tel i'K i'ii:

■ u .117;

TÏT IWHldlM*

*

HT ■ ■

ti.nJ my

F"

1- -11 r r

1

Fl 1. FI.T-LWH

=11 UUy

F- f i-rl"i. ■■■.

P"IIC L.

5-

■ mtaiMto

■ u .117;

p

1 ^rc x

s

^«l &"<■ -J

-■.■. lUy

■-JKFSW 1

Ifc Jrfld-riiL

T

&K1S1K)

■-ii-imh

i-ini I -i-.-i^aif--.1 -■ i-.r -m i= -v. TJ:K-J TÏ.JC -FU:

J "..-I "J-™ TT. I" "FH"

the DataSheet worksheet

MHiu4+n 5iibMinij'1+M OnwittLiinu OnÇhirl Ne'Xi t^Dv^^-rii: mUE "hut.

i-ini I -i-.-i^aif--.1 -■ i-.r -m i= -v. TJ:K-J TÏ.JC -FU:

J "..-I "J-™ TT. I" "FH"

0 0

Post a comment