What
is a
userform in Excel? You can make data entry into an Excel
worksheet easier and automate calculations for the user by creating a
user-friendly interface with the help of a userform.
How to create a user-form:
Click on the Developer Tab in the Microsoft Office
Ribbon
A default UserForm1 is created in a directory called
Forms
and a form with the Caption UserForm1 appears. If the form is selected
which you can know if you see the handles around it, you'll also see a
box called Toolbox which has many icons called controls.
With the Form selected click on view in the menu bar
and
select properties window to see another window that displays the
properties of the Form.
Enter a name of the form like 'frmEmpData' and a
caption
like 'Employee Data' to make the userform look more user-friendly.
You can now add labels, text boxes and command
buttons on
the form by clicking on the controls and then clicking and dragging on
the user-from.
You can set the properties of the controls.
Next you can write appropriate code which will
execute at
your command or at run-time.
For example, we have added a line of code
to the command button to
transfer the name of the employee from the text-box to the Excel
worksheet.