Open User Form Using Command Button

How to Open the UserForm using a Command Button on a Worksheet
You can make it easier for the user to open a user-form for data entry by inserting a command button on an Excel worksheet and attaching appropriate code to it. The attached code is shown below:

frmEmpData.Show

How to implement the process:

Click on the developer tab

In the ‘controls’ group select ‘Insert’

Under ‘ActiveX Controls’ click on a command button

Now click and drag on the Excel worksheet at an appropriate location a command button

Right-Click on the command button, select properties and assign an appropriate name and caption to it.

Double Click on the command button and enter the line of code shown above between the ‘sub…….’ and ‘end sub’ code lines as shown at the bottom of the complete code in bold.

2 thoughts on “Open User Form Using Command Button”

Is it possible to assign a unique worksheet on every single item of the listbox, so that when a specific item is selected in the listbox, the data should be captured in the corresponding unique sheet.

For example: The items in the Listbox are Names, Department and Block. On the workbook there are 3 worksheets named Names, Department and Block. So if a user selects Names from the Listbox the the data should be captured in the Names worksheet and so on.