Preparing a Worksheet to Store Custom Form Data

After the user selects appropriate options on the custom form and clicks OK, the selected data will be transferred to a worksheet. However, before this happens, you must prepare a worksheet to accept the data and give the user an easy interface for launching your form. Follow the steps below to get your worksheet ready:

1. Activate the Microsoft Excel window.

2. Double-click the Sheet1 tab in the Chap10.xls workbook, and type the new name for this sheet: Info Survey.

3. Enter the column headings shown in Figure 10-13.

4. Select column K and row 1, and change the background of all cells to your favorite color (use the Fill Color button on the Formatting toolbar).

The easiest way to launch a custom form from a worksheet is by clicking on a button. The remaining steps walk you through the process of adding the Survey button to your Info Survey worksheet:

5. Choose View | Toolbars, and select Forms.

Ej Microsoft L xcc-l

^^^■JGIXI

File Edit View

insert Format

Xools Data

Window Help

Type a question for help t

Arial

- 10 v | B

I UK

5 m üü $

m * <3» T A - £

Q^Bt i

IB? ¡k

SI |

SN" I

Ü 100S v rn »

All

fir

_

M < ^ n"Klnfn Survey / 5heet2 / 5heet3 7 llf^

DrawT D^

AutoS hapesT \ \ Q O HI 41 0 ® Q

& - -JL - 4 - = i "

Ready

Figure 10-13: The Survey button will launch the Info Survey form. When the user clicks OK on the form, the form entries will be placed in this worksheet.

. Click the Button control on the Forms toolbar. Click in column K and row 2 (cell K2) to place a button. When the Assign Macro dialog box appears, type DoSurvey in the Macro name box, and click OK. You will write this procedure later.

. When you return to the worksheet, the button (Button1) to which you assigned the DoSurvey macro should still be selected. Type the new name for this button: Survey. If the button is not selected, use the right mouse button to select it. Choose Edit Text from the shortcut menu, and type Survey for the button's new name. To exit the Edit mode, click outside the button.

. Save the changes you've made to Chap10.xls.

0 0

Post a comment