Form Control in Excel VBA

Forms are another way to facilitate bi-directional communication in Excel. Inputbox and Messagebox are simpler way to do the same. As the complexity in terms of input and output variables increase, we tend to use Forms to minimize and control it. After using Form based control, one will realize the real meaning of "V" in VBA. Working with Forms is unarguably the most fun. One needs to be creative to extract maximum out of it. Excel VBA supports several Form controls but the most popular and frequently used ones are listed below.
  1. Command Buttons - As soon as user clicks on them, a procedure is activated
  2. Label - Used for description and guidance
  3. Textbox - Used to get input (any type) from the user
  4. Listbox -  This allows user to make single or multiple selection out of several input available 
  5. Combobox - Functionality wise same as Listbox. It allows user to enter an input/item which is not present in the list 
  6. Checkbox - Lets user to check/uncheck an option 
  7. Radiobuttons - It lets user to select one out many options available to user
  8. Frame/Group Box - Mainly used to group
 Every Form Control has certain set of properties i.e. Name, Caption etc. The properties control the look. 

Click on the Visual Basic editor in Excel/Developer Tab. This will open VBE window.



Select the workbook. Right Click and Insert Userform in the project as shown below.


 This will create a Form and toolbox window will open up. The same has been shown in the figure.


The toolbox window shows frequently used controls. Apart form them, Excel-VBA support an exhaustive list of form control. Right click in Toolbox window and you will see all of them listed under Additional Controls. It is very easy to make them available in Toolbox window. Select them, click ok and they will become part of the Toolbox menu.

In the subsequent blog, I will show how to use form control to streamline and automate our work.