Browse » Home
Wednesday, August 17, 2011
How to Create a Form Using Microsoft Excel
1. Insert form. Open a new workbook in Microsoft Excel. Press the 'Alt' and 'F11' keys on your keyboard to open Microsoft Visual Basic. Double click on 'Sheet 1' (Sheet 1) under Microsoft Excel Objects in the left window pane under VBAProject. Go to the Insert menu and select 'UserForm' to insert a form.
2. Name form. Go to the Properties window in the left window pane and click on 'UserForm1' next to (Name). Type a new name for your form. Hit 'Enter.'
3. Add text box. Click on the 'Textbox' button in the Toolbox toolbar. Click on a place in the form where you would like to add a standard-sized text box. You can adjust the size of the box using the handles. Go to the Properties window in the left window pane and click on 'TextBox1' next to (Name). Type a new name for your text box. Hit 'Enter.' Repeat this step for additional text boxes you would like to add.
4. Add label. Click on the 'Label' button in the Toolbox toolbar. Click on a place in the form where you would like to add a standard-sized text label. Adjust the size of the box using the handles. Go to the Properties window in the left window pane and click on 'Label1' next to (Name). Type a new name for your label. Hit 'Enter.' Repeat this step for additional labels.
5. Add buttons. Click on the 'Command' button in the Toolbox toolbar. Click on a place in the form where you would like to add a standard-sized button. Go to the Properties window in the left window pane and click on 'CommandButton1' next to (Name). Type a new name for your button. Hit 'Enter.' Change the caption to the text you would like to appear on the button such as 'Login.' Repeat this step for additional buttons you would like to add.
6. Add code. Select the button, go to the View menu and select 'Code.' Enter code functionality for the button. Go to the View menu and select 'Object' to go back to the user form. See the link in Resources below for examples of button codes.
7. Test form. Go to the Run menu and select 'Run Sub/UserForm' to run the form.