Testing the macro

Finally, you need to test the macro and dialog box to make sure they work properly:

1. Activate a worksheet (any worksheet in any workbook).

2. Select some cells that contain text.

3. Press Ctrl+Shift+C.

The custom dialog box appears. Figure 16-8 shows how it should look.

4. Make your choice and click OK.

If you did everything correctly, the macro makes the specified change to the text in the selected cells.

Figure 16-9 shows the worksheet after converting the text to uppercase.

As long as the workbook is open, you can execute the macro from any other workbook. If you close the workbook that contains your macro, Ctrl+Shift+C no longer has any function.

If the macro doesn't work properly, double-check the preceding steps to locate and correct the error. Don't be alarmed; debugging is a normal part of developing macros. As a last resort, download the completed workbook from this book's Web site.

Figure 16-8:

The custom dialog box is in action.

Figure 16-8:

The custom dialog box is in action.

Figure 16-9:

The text has been converted to uppercase.

chanye case

itls

UsM

A

B

C

D

E

F' I G I H

1

&UAR1

2

. ;

3

MAROTH

APRIL

S

MAY-

E

iälÄ:

7

JUtî

=

8

WS0ST

y

SEPTEMBER

10

BCTpBER

11

NOVEMBER

12

DECEMBER?!

13

14

ïSs

1E

17

S

f M\sheetl^

m

> 1

0 0

Post a comment