

The first control in the list will be the one that is active (flashing cursor) when the form is activated.

To do so, right click on the form itself and select the "Tab Order" item. To make sure that the user moves from a control to the next one you need to set the tab order. The user can use the mouse to move from one control to the other but he should be able to move from one control to the other by entering a value in one and clicking "Enter" or "Tab". Once you have added the controls here is an important feature. You can also right click on them and select "Properties". Once all your controls are on the form you left click on them and in the properties window you can change the properties of the selected control. You can now expand the control to the desired size. To add controls to the form you left click on whatever control that you want in the Toolbox, hold the button down and drag the control on the form. They are (starting with the most used): Label, TextBox, CommandButton, ComboBox, ListBox, CheckBox, OptionButton, ToggleButton, Frame, TabStrip, MultiPage, ScrollBar, Image, RefEdit and the calendar.
/parts-of-the-excel-2010-screen-56a8f7f15f9b58b7d0f6cbaf.gif)
To return to the VB Editor just click on the " X" of the userform. Your userform will show with Excel in the background. You can close the toolbox by clicking on its " X" and call it back by clicking on the toolbox icon on the toolbarĪnytime that you want to see your userform (finished product or work in progress) at work or when you want to test it select the userform by clicking in ay part of it that is empty (and not one of the controls), click on the "Run" button on the toolbar. Anytime you want to work on your userform you double click on its name in the Project window. In the list of components of your project the userform name appears. In the VBE ( Visual Basic Editor) you right click anywhere on your project in the Project Window and select "Insert/UserForm" and here is what you see: Creating a userForm in VBA for ExcelĬreating a form in VBA is quite easy. To learn more about all the controls see lessons 3-3 to 3-10.īefore you start developing a userform to enter data in an Excel database see the data entry form that Excel offers you. This problem might even occur with the calendar. You can find all kinds of other controls on the Internet but the problem is that if you send your workbook to other people and the new control is not installed on their computer it wont work. Different basic controls can be added to the userform they are called: Label, TextBox, ComboBox, ListBox, CheckBox, OptionButton, ToggleButton, Frame, CommandButton, TabStrip, MultiPage, ScrollBar, SpinButton and Calendar. The form is used to require values, parameters and information from the user to feed the VBA procedure. The form or userForm is also known as a GUI (Graphical User Interface). VBA Lesson 3-1: Forms (Userforms) in VBA for Excel
