Page 218 - Excel Data Analysis
P. 218
11 537547 Ch10.qxd 3/4/03 12:03 PM Page 204
EXCEL DATA ANALYSIS
CREATE A CUSTOM DIALOG BOX
ou can create custom dialog boxes to use in You can change the name of a UserForm to make it easier
conjunction with any of your macros. You can use this to identify when you look at the UserForms listed in the
Y custom dialog box to simplify the data collection or Project window. To change the name of a UserForm, you
data analysis process because dialog boxes add a graphical must change the Name property for the UserForm within
user interface; they let users click buttons to indicate a the Properties window.
specific selection or to input an appropriate value. When After you create a UserForm, you can design it using the
you use VBA to create macros, you also gain most Visual various Toolbox controls, which appear only when you
Basic features, including the ability to create custom dialog select the UserForm window. You add controls to the
boxes. VBA refers to these custom dialog boxes as Forms or UserForm by dragging them from the Toolbox to the
UserForms.
appropriate location on the UserForm. After you add a
You create a custom dialog box within the Visual Basic control, you can resize it as needed. The Visual Basic Editor
Editor with the UserForm option. The Visual Basic Editor applies default values for each of the control properties.
creates a new UserForm called UserForm1 in the Forms You can change the assigned values to the properties for
folder in the Project window. The Forms folder displays only the control within the Properties window. Remember that
if you have created UserForms for the current project. you need to select the control on the UserForm before you
can set the properties.
CREATE A CUSTOM DIALOG BOX
⁄ In the Projects window, ■ The project name ■ The Visual Basic Editor ‹ Type a new name for the
select the project to which corresponds to the name creates a blank UserForm UserForm in the Name field
you want to add the new of a workbook. with a default name of of the Properties window.
UserForm. UserForm1.
¤ Click Insert ➪ UserForm. › Click the UserForm.
204