Microsoft Office Tutorials and References
In Depth Information
Displaying, loading, and hiding UserForms
If two records were already in the target worksheet and you entered data from the
UserForm, the result would be the following list.
TIP On the Developer tab of the ribbon, you will also find buttons that you can use to add
worksheet Form controls and ActiveX controls. You can use the skills learned in this section
to create those controls and assign VBA code to them.
Displaying, loading, and hiding UserForms
After you create a UserForm, you must display it so that the user can interact with it. As an
example, suppose you have a form named frmShipmentEntry . All you need to do to display
the form is enter the name of the form followed by a period and the Show method. For
example, the code to display frmShipmentEntry would be as follows.
frmShipmentEntry.Show
You can test a UserForm from within the Visual Basic Editor by displaying the UserForm and
pressing the F5 key. You can also enter a UserForm into Excel’s memory without displaying
it by using the Load method. The command to load the same form into the Excel program’s
memory is as follows.
frmCustomerEntry.Load
When you want to display the UserForm in Excel, you can call the Show method as noted
earlier.
Hiding a UserForm relies on the Hide method. The syntax follows the pattern used for the
Show and Load methods.
frmCustomerEntry.Hide
The most common way to invoke the Hide method is to create a command button with the
label Cancel and add the code including the Hide method in the command button’s On_
Click event handler. You can also hide a UserForm by clicking the Close box in the
upperright corner of the UserForm.
Search JabSto ::




Custom Search