Microsoft Office Tutorials and References
In Depth Information
Part 5: Manipulating Excel Objects
Microsoft Office Excel 2003 Programming Inside Out
Figure 20-1. A simple worksheet tracks customer information such as name and address
and the date the customer was added.
Designing a Form
For most data-driven forms, you should place the fields in a single column with labels next to
each field. This arrangement makes it easy for the user to find information on the form.
However, with some fields, such as those that are part of an address, you might find it better
to arrange the fields more intuitively, such as placing the City, State, and ZipCode fields on
the same line.
It’s important to note that the placement of the fields on the form is completely independent
of the code that accesses it. If you wished to arrange all of the fields in a circle, it wouldn’t
make a bit of difference to your code. While this fact is something that might seem obvious,
it was the revolutionary concept that started the Microsoft Visual Basic revolution.
Tip Work with What Works
When designing user forms, take a look at the various windows and dialog boxes built into
Excel and other applications for design ideas.
Follow these steps to create a form that will interact with the user:
Start the Visual Basic Editor, and choose Insert, UserForm from the main menu. This
will create a new UserForm object in your application.
From the Toolbox, drag a Te xtBox control and a Label control for each column in the
worksheet. Drag a ComboBox control to hold the list of states. You might have to
adjust the size of the user form to accommodate the controls.