Anda di halaman 1dari 5

What is a Form?

A form, whether printed or online, is a document designed with a standard structure and
format that makes it easier to capture, organize, and edit information.

 Printed forms contain instructions, formatting, labels, and blank spaces for
writing or typing data. You can use Excel and Excel templates to create printed
forms.
 Online forms contain the same features as printed forms. In addition, online forms
contain controls. Controls are objects that display data or make it easier for users
to enter or edit data, perform an action, or make a selection. In general, controls
make the form easier to use. Examples of common controls include list boxes,
option buttons, and command buttons. Controls can also run assigned macros
and respond to events, such as mouse clicks, by running Visual Basic for
Applications (VBA) code.

You can use Excel in several ways to create printed and online forms.

Types of Excel forms


There are several types of forms that you can create in Excel: data forms, worksheets
that contain Form and ActiveX controls, and VBA UserForms. You can use each type of
form by itself, or you can combine them in different ways to create a solution that's right
for you.

Data form

A data form provides a convenient


way to enter or display one
complete row of information in a
range or table without scrolling
horizontally. You may find that
using a data form can make data
entry easier than moving from
column to column when you have
more columns of data than can be
viewed on the screen. Use a data
form when a simple form of text
boxes that list the column headings
as labels is sufficient and you don't
need sophisticated or custom form
features, such as a list box or spin
button.

Excel can automatically generate a built-in data form for your range or table. The data
form displays all column headers as labels in a single dialog box. Each label has an

T6 Readings - 05a Form Overview Ankit Mehrotra 1


adjacent blank text box in which you can enter data for each column, up to a maximum
of 32 columns. In a data form, you can enter new rows, find rows by navigating, or (based
on cell contents) update rows and delete rows. If a cell contains a formula, the formula
result is displayed in the data form, but you cannot change the formula by using the data
form.

Worksheet with Form and ActiveX controls

A worksheet is a type of form that enables you to enter and view data on the grid, and
there are several control-like features already built-in to Excel worksheets, such as
comments and data validation. Cells resemble text boxes in that you can enter and
format them in a variety of ways. Cells are often used as labels, and by adjusting cell
height and width and merging cells, you can make a worksheet behave like a simple data
entry form. Other control-like features, such as cell comments, hyperlinks, background
images, data validation, conditional formatting, embedded charts, and AutoFilter can
make a worksheet behave like an advanced form.

For added flexibility, you can add controls and other drawing objects to the drawing
canvas of a worksheet, and combine and coordinate them with worksheet cells. For
example, you can use a list box control to make it easier for a user to select from a list of
items. Or, you can use a spin button control to make it easier for a user to enter a
number.

Because controls and objects are stored on the drawing canvas, you can display or view
controls and objects alongside associated text that is independent of row and column
boundaries without changing the layout of a grid or table of data on your worksheet.
Most of the time, many of these controls can also be linked to cells on the worksheet and
do not require VBA code to make them work. You can set properties that determine
whether a control floats freely or moves and resizes together with a cell. For example,
you might have a check box that you want to move together with its underlying cell
when the range is sorted. However, if you have a list box that you want to keep in a
specific location at all times, you probably do not want it to move together with its
underlying cell.

Excel has two types of controls: Form controls and ActiveX Controls. In addition to these
sets of controls, you can also add objects from the Drawing tools, such as a AutoShapes,
WordArt, SmartArt graphic, or text boxes.

The following sections describe these controls and drawing objects, and also explain how
to work with these controls and objects in more detail.

T6 Readings - 05a Form Overview Ankit Mehrotra 2


Form controls
Form controls are the original controls that are compatible with earlier versions of Excel,
starting with Excel version 5.0. Form controls are also designed for use on XLM macro
sheets.

You use Form controls when you want to easily reference and interact with cell data
without using VBA code, and when you want to add controls to chart sheets. For
example, after you add a list box control to a worksheet and linking it to a cell, you can
return a numeric value for the current position of the selected item in the control. You
can then use that numeric value in conjunction with the INDEX function to select
different items from the list.

You can also run macros by using Form controls. You can attach an existing macro to a
control, or write or record a new macro. When a user of the form clicks the control, the
control runs the macro. However, these controls cannot be added to UserForms, used to
control events, or modified to run Web scripts on Web pages.

Summary of form controls


Controls Example Description

Identifies the purpose of a cell or text


box, or displays descriptive text (such as
Label
titles, captions, pictures) or brief
instructions.

Groups related controls into one visual


unit in a rectangle with an optional label.
Group box
Typically, option buttons, check boxes, or
closely related contents are grouped.

Runs a macro that performs an action


Button when a user clicks it. A button is also
referred to as a push button.

Turns on or off a value that indicates an


opposite and unambiguous choice. You
can select more than one check box on a
worksheet or in a group box. A check box
Check box
can have one of three states: selected
(turned on), cleared (turned off), and
mixed, meaning a combination of on and
off states (as in a multiple selection).

T6 Readings - 05a Form Overview Ankit Mehrotra 3


Controls Example Description
Allows a single choice within a limited set
of mutually exclusive choices; an option
button is usually contained in a group box
or a frame. An option button can have
Option
one of three states: selected (turned on),
button
cleared (turned off), and mixed, meaning
a combination of on and off states (as in a
multiple selection). An option button is
also referred to as a radio button.
Displays a list of one or more items of
text from which a user can choose. Use a
list box for displaying large numbers of
choices that vary in number or content.
There are three types of list boxes:

 A single-selection list box enables


only one choice. In this case, a list
box resembles a group of option
buttons, except that a list box can
List box
handle a large number of items
more efficiently.
 A multiple-selection list box
enables either one choice or
contiguous (adjacent) choices.
 An extended-selection list box
enables one choice, contiguous
choices, and noncontiguous (or
disjointed) choices.

Combines a text box with a list box to


create a drop-down list box. A combo box
is more compact than a list box but
requires the user to click the down arrow
to display the list of items. Use a combo
Combo box
box to enable a user to either type an
entry or choose only one item from the
list. The control displays the current value
in the text box, regardless of how that
value is entered.
Scrolls through a range of values when
you click the scroll arrows or drag the
scroll box. In addition, you can move
Scroll bar through a page (a preset interval) of
values by clicking the area between the
scroll box and either of the scroll arrows.
Typically, a user can also type a text value

T6 Readings - 05a Form Overview Ankit Mehrotra 4


Controls Example Description
directly into an associated cell or text
box.
Increases or decreases a value, such as a
number increment, time, or date. To
increase the value, click the up arrow; to
Spin button decrease the value, click the down arrow.
Typically, a user can also type a text value
directly into an associated cell or text
box.

T6 Readings - 05a Form Overview Ankit Mehrotra 5