The Leading Edge: Using Excel Forms
R. Jason Weiss
Development Dimensions International
Have you ever come across a tool so obviously useful that it actually inspired you to find ways to use it? I did, when I came across some brilliant applications of the forms functionality in Excel. By the end of this edition of
Leading Edge, I think you, too, will start to see ways to leverage Excel forms to make some piece of what you do easier, faster, more flexible, or more convenient.
In principle, Excels form controls are no different from standard elements of the Windows interface. We use these controls every daycheckboxes, option buttonstheyre the little circles that you click on to choose one from a set of mutually exclusive choices, list boxes (boxes with a list of options from which to select), and so forth. What makes these controls different for our purposes is that we will be using special versions of them designed for Excel spreadsheets. Specifically, the majority of the form controls reviewed here return values to designated cells in your Excel spreadsheet, and some of them draw the options they present from it, as well. Therefore, you can think of building Excel forms as akin to building a specialized Windows interface just for your spreadsheet.
All kinds of applications spring to mind. You can build extremely slick data-collection tools. Use forms to add flexibility in how you perform computations or return data. Create forms that alert the user to data-entry errors. Create interactive tests! The possibilities are truly endless. Excited to learn more? Lets dive in.
The Tools in the Toolbox
There are actually two different toolbars in Excel that supply form controls. The main controls we will discuss are in the Forms toolbar, though we will use a few from the
Controls Toolbox, as well. Some form controls are actually on both the Forms toolbar and the
Controls Toolbox, which introduces additional confusion. The difference is that the controls in the
Controls Toolbox are considerably more powerful than those in the Forms toolbar, and are designed more for programming than for quick configuration and use. Since the goal here is to get the most effect with the least fuss, we will rely on the considerably simpler
Forms toolbar controls and use just a couple of key controls from the Controls Toolbox.
Both the Forms toolbar and the Controls Toolbox may be accessed by selecting the
View menu and choosing Toolbars.
Figure 1 shows the form controls discussed here. Figure 2 illustrates the Forms toolbar and its component controls. Note the grayed-out controls in the toolbar. These are included for compatibility with Excel 5a long-ago version of the programand are only enabled when editing an Excel 5 workbook. Briefly, here are the controls we will be using from the
Forms toolbar. Note that the controls presented here are ordered by their typical frequency of use, relationship, and function, and not in the order in which they are shown on the
Figure 1. Excel form controls.
Figure 2. Excels forms toolbar.
Checkbox. The checkbox control can be used to evaluate individual statements or cases as true or false, or to set up an array of nonmutually exclusive options (e.g., In the following list, select up to three reasons why you chose to major in psychology).
Option buttons. Option buttons, also known as radio buttons, offer a set of predefined, mutually exclusive choices (e.g., highest level of education achieved).
Group box. The primary functional use of group boxes is to define groupings of option buttons. For example, if you had a set of option buttons for highest level of education achieved, and another set for gender, the only way Excel would know that they are not one big group is if they were contained in separate group boxes. Without group boxes, selecting one of the gender option buttons would deselect whichever choice was made for highest level of education.
List box. The list box provides a set of options from which the form user may choose one or more. The difference between the list box and the other choice-related controls above is that the list box draws its set of options from designated cells within the spreadsheet. The list box therefore has the potential to be much more dynamic than the checkbox or option buttons. For example, the cells designated for the list box may draw from responses to earlier items, creating a customized list box for each form user.
Combo box. A combo box is similar to a list box in that it draws its available values from a range of cells within the spreadsheet. It differs in that it does not provide the capability to select more than one option at a time.
Scroll bar. The scroll bar is similar to the scroll bar on the side or bottom of any application window. However, there is nothing to say that a scroll bar can not be used creatively to position a response within a rating scale for example. Frankly, from a user interface design perspective, I think this would look a little suspect, but it is an option that is available.
Spinner. The spinner provides a way to quickly change a value up or down by designated increments. Single clicks on the up or down arrow buttons change the value up or down by the designated increment. If the arrow buttons are held down, the value continues to change.
Button. The button control runs a designated macro. This can be very handy if you are a macro user and will not be sharing your spreadsheet widely. However, given that macro viruses are a widespread concern, many user installations of Excel have macros turned off by default. As a result, buttons are not considered any further in this article.
Label. Unfortunately, the label control on the Forms toolbar is all but useless. The idea behind the label control is to provide a flexible way of placing text on the spreadsheet, without concern for cell boundaries. As such, the label control is minimally usable. However, the font and paragraph alignment of the label control cannot be altered, and more flexible options are readily available, so we will not consider the
Forms toolbar label control any further.
There are several other buttons on the Forms toolbar that are not form controls. The
Control Properties button opens a window offering a number of ways to configure a selected control. The
Edit Code button is for controls that can be associated with macros; clicking on it opens the macro editing window. Finally, the
Toggle Grid button lets you show or hide the gray cell gridlines. As will be discussed below, the gridlines should typically be toggled off when deploying a form.
The Controls Toolbox, shown in Figure 3, offers several additional controls that can be leveraged without much extra effort. The Text Box control provides a text-entry area for the form user. The Label control provides a welcome level of control over text formatting compared to its counterpart described above. Properties for both of these controls are accessed by selecting the control on the worksheet and clicking the Control Properties button.
Figure 3. Excels controls toolbox.
Getting Control of Your Controls
To place a new control on your Excel spreadsheet, click on its icon on the Forms toolbar, then click on the worksheet. The new control will be positioned so that its top left corner is at your mouse cursor. To move, resize, or otherwise configure a control, you must first select it. The easy way to do this is to hold down the Control key on your keyboard and then click on the control. The control will then be bounded by a dotted box with circular sizing handles at each corner and on each side. To move the control, drag it by the dotted border to its new location. To resize the control, drag the circular sizing handles. Finally, to edit the text on the control, known as its
caption, you can usually click on the caption itself. The dotted pattern of the controls border will change to a hatched pattern to indicate that you are in caption editing mode.
Once you have added and positioned your controls, you need to configure them to work with your spreadsheet. Begin this process by right clicking on the control and selecting Format Control from the context-sensitive menu. The resulting interface has a number of tabs, all of which are fairly similar in content across controls, though the exact set of tabs may differ depending on which control is selected. For example, there is no
Colors and Lines tab for a Group Box. The last tab, Control, is where the spreadsheet-related configuration takes place. Here, too, different controls have different configuration options. Following is a complete list of the configuration options. Figure 4 shows which configuration options apply to each control.
3-D shading. Applies shading to the control for a three-dimensional appearance. This is deselected by default. Frankly, the 3-D-shaded version looks much better. I always select it when I create a form that I will share with others.
Cell link. The spreadsheet cell where the control will output its value. Table 1 displays the possible output values for each of the controls.
Value. The default value for checkboxes and option buttons, set as either
checked (selected), or unchecked (deselected). Checkboxes have a third value called
mixed. Im sure there are some good uses for this as a default setting; however, it can only be set when you are designing the form. Someone entering data into the form would not be able to set a checkbox to
Input range. The choices listed in a combo box or list box are actually cell values. The input range specifies the addresses of those cells. For example, say you wanted to have a combo box in which someone specifies their favorite color. You would specify available choices in a series of cells (e.g., Mauve in cell B1, Lavender in cell B2, and so on down to cell B20), then enter the address range of the series (e.g., B1:B20) as the combo box input range. The combo box would then display the color choices, one per row.
Selection type. This setting only applies to the list box control. The main option for our purposes is
single (only one choice can be selected at a time). The other options, multi and
extend, require programming to use and are therefore out of the scope of this article.
Drop-down lines. The number of lines of choices (one choice per line) displayed when the user clicks on a combo box. If the value entered for drop-down lines is less than the number of choices specified in the input range described above (e.g., there are twenty colors to choose from, but only six are shown at a time per the drop-down lines setting), the combo box will automatically provide a scroll bar for accessing the additional choices.
Current value, minimum value, maximum value, incremental change, page change. These options apply to scroll bar and spinner controls. The
current value is the numeric value to which the control is currently set.
Minimum and maximum values indicate the range of values allowed.
Incremental change is the amount by which the control value changes when the user presses the arrow buttons. Finally,
page change reflects the amount a scroll bar control value changes with each step of the scroll bar.
Figure 4. Configuration options for controls in the controls toolbox.
Cell Link Output Values for Controls in the Controls Toolbox.
||True if the checkbox is checked; False if it is not checked;
#N/A if it maintains a default value set to mixed.
||A value corresponding to the option buttons ordinal entry to the set of option buttons. The first option button added to the set returns the value
1. The second returns the value 2, and so on. The key to remember is that the value returned relates to the order in which the option buttons were added, not to their relative physical position.
|List box, combo box
||The numeric position of the selected item. The first item in the list returns a
1, the second a 2, and so forth.
|Scroll bar, spinner
||The current value of the control.
Your First Form
Lets explore the power of forms with a simple applied example. Based on no research whatsoever, I believe that there is a driving need for a selection test for circus clowns, and I am enlisting you to help me create the Weiss Circus Clown Selection Test (WCCST). Naturally, it is not represented as having any qualities other than usefulness for helping you get started with Excel forms, so please dont try to select a clown with it.
Start up Excel and make sure you have three worksheets. We will use the first worksheet as our form. Lets rename the worksheet by clicking on the
Format menu, and choosing Sheet | Rename. Rename the sheet to WCCST. Select the second sheet by clicking on its tab at the bottom of the Excel interface and rename it to Responses. Select the third sheet and rename it to ListBoxData.
Checkbox. One good way to start out the WCCST would be to have the test taker evaluate some statements. Open the
Controls Toolbox and place a new Label control on the WCCST worksheet. Click on the
Properties button in the Controls Toolbox and in the cell by Caption, enter Check each of the statements below that applies to you. You may need to resize the label control to fit the text. We will include just two statements to evaluate. Add a checkbox from the
Forms toolbar and enter the following caption: I like my shoes to be as big and floppy as possible. Click on the
Control Properties button on the Forms toolbar, select the Control tab and enter Responses!B1 into the
Cell Link box. This means that the response to this checkbox will be recorded in the
Responses worksheet, in cell B1. Go to the Responses worksheet and type Floppy shoes in cell A1. This will serve as a reminder of the item when we review the data. Add a second checkbox with another statement of your choice. Set the cell link to Responses!B2 and enter your reminder prompt on the
Option buttons. Next, lets put in a multiple-choice, skill-testing question. This is an ideal use of option buttons. Go back to the WCCST worksheet and add a group box below the checkboxes. Size it fairly large so that we have lots of room to make adjustments. Delete the caption by editing it and removing all of the caption text. Add a label as described above, and put in the following text: What is the maximum occupancy of a subcompact car? Add four option buttons from the
Forms toolbar, and set their captions to 2, 4, 5, and 10 to 12, depending on their size and flexibility. Select any radio button and go into its
Control Properties. Set the Cell Link value to Responses!B3. You do not need to set the
Cell Link value for the other option buttons; all option buttons in a group automatically take the same
Cell Link value. Go to the Responses worksheet and enter Small car as a reminder in cell A3.
Combo Box. Add a label and set its caption to, If I could be any animal in the world, I would be a Below that, add a combo box from the
Forms toolbar and resize it as necessary. Go into its Control Properties
and set its Input Range to ListBoxData!A1:A10. Set its Cell Link to Responses!B4. Go to the
ListBoxData worksheet and enter the following animal names in cells A1 through A10: llama, goat, monkey, yeti, squirrel, Cornish game hen, wild boar, egret, armadillo, and sloth. Go to the
Responses worksheet and enter Animal as a reminder in cell A4.
Spinner. You can use the spinner control to have the test taker specify the number of balls he or she could juggle. Add a label and set its caption to, I can juggle the following number of balls at once and still tell jokes. Add a spinner control from the
Forms toolbar and set its Cell Link to the address of an adjacent cell. Set the
Minimum Value to 1 and the Maximum Value to 25. To keep the output data in one place, we will copy the
Cell Link location to the Responses worksheet. Take note of the spinners
Cell Link address and select the Responses sheet. In cell B5, enter =WCCST![Cell Link Address]. In cell A5, enter Can juggle.
Text box. Finally, lets throw in a text box for an essay question. Go back to the WCCST worksheet and put in a final label with the caption, In 100 words or fewer, just why do you want to be a circus clown, anyway? Add a text box from the
Controls Toolbox. Click on the Properties button in the Controls Toolbox and in the
LinkedCell field, enter Responses!B6. Add the word Essay in cell A6 on the
The last step is to protect the worksheets by preventing users from acting on anything but the form controls. Select the WCCST worksheet. On the
Tools menu, select Protection | Protect Sheet. Deselect all of the checkboxes in the list box at the bottom of the
Protect Sheet window. Youre done! Play with the various questions and verify your responses on the
Responses worksheet. Pretty easy, no?
If you are looking to deploy your form to end users, you want it to look as professional as possible. The tips and tricks described below will both make your form look its best and remove distracting trappings of the Excel interface. As an example of what is possible in this regard, I have made available my version of the WCCST for download at
Improving Your Forms Appearance
Use graphics. I have seen graphics used in two ways on Excel forms. The first way is as pure decorationa company logo, a fancy graphic title, and so forth. Existing graphics can be added to your form by clicking on the
Insert menu, and choosing Picture. A second way to use graphics is to use cell borders and shading to lend visual structure and color to the form. To do this, select a group of cells, click on the Format menu, and choose
Cells The Border and Patterns tabs offer many interesting and useful formatting options.
Align form controls. Form controls are hard to position exactly. Fortunately, the
Draw toolbar offers several options to make this task easier. To have the control edges automatically align with your worksheets cell edges, use the snap-to grid. It is enabled by clicking on the
Draw menu button on the Draw toolbar, and selecting Snap | To Grid.
When working with multiple items positioned in close proximity, such as checkboxes, you may also find it convenient to use the automatic alignment and distribution tools.
Select Draw | Align or Distribute to access this functionality.
Hiding Excels Busy Interface
Your goal is to have the user focus on the form, not on Excel. You can hide much of the Excel interface, if you know where to find the options. Select the
Tools menu, choose Options, then click on the View tab. At the bottom of the window, under
Window options, heres what you can uncheck:
Row and column headers. These are the row and column labels, A, B, C,
and so forth. They are clearly unnecessary, as form users are unlikely to be concerned with cell addresses.
Gridlines. This is identical to the Forms toolbars Toggle Grid functionality. It removes the worksheets gridlines from view.
Sheet tabs. This hides the worksheet tabs at the bottom of the Excel window. It is also helpful to hide all sheets but the worksheet with the form. Hiding sheets is accomplished by clicking on the
Format menu and choosing Sheet | Hide.
Formula bar. This checkbox is at the top of the View tab, under Show. There is usually no reason not to hide the formula bar from a form user.
The Last Word
As always, I look forward to any feedback on this articleparticularly if it was helpful to you. Please e-mail me at
firstname.lastname@example.org with your thoughts and reactions. Of course, I will not be able to answer specific Excel questions. Thank you for reading, and good luck with your Excel form projects!
April 2004 Table
of Contents | TIP Home
| SIOP Home