

{"id":97896,"date":"2021-07-16T09:00:24","date_gmt":"2021-07-16T03:30:24","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=97896"},"modified":"2021-07-08T17:46:24","modified_gmt":"2021-07-08T12:16:24","slug":"vba-controls","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/vba-controls\/","title":{"rendered":"VBA Controls &#8211; Form Control &#038; ActiveX Control in Excel"},"content":{"rendered":"<h3>What is a VBA form?<\/h3>\n<p>A form is a document designed with a format to collect, organize and edit information. There are two types of forms.<\/p>\n<ul>\n<li>Printed Forms<\/li>\n<li>Online Forms<\/li>\n<\/ul>\n<h4>Printed Forms:<\/h4>\n<p>These are the forms that may use an excel template to organize the questions to be asked via forms. It contains instructions, formatting, labels, and data.<\/p>\n<h4>Online Forms:<\/h4>\n<p>Online forms are more similar to the printed forms but online forms contain controls. These controls are the objects that display, enter or edit data, perform an action or execute a selection. Controls make the form much more simpler and easier to use.<\/p>\n<p>Some of the common controls are list box, option buttons and the controls can also run the macros and respond to events such as by running the VBA code, clicks on the button created in the Excel spreadsheets.<\/p>\n<h3>Types of Excel forms<\/h3>\n<p>There are different types of forms such as data forms, VBA userforms and the spreadsheet that contains ActiveX and form controls. The user can create individual forms or combine all types of forms in different ways to achieve the requirement appropriately.<\/p>\n<h3>Worksheet with Form and ActiveX controls<\/h3>\n<p>A worksheet is where the user enters and views the data and there are also many built-in functions to organize the data and derive some conclusions from it. The user can enter and format the cells in many ways. The user can use the cells as labels and by adjusting the height, width, and merging of cells, the user can make the spreadsheet look like a data entry form.<\/p>\n<p>The other features such as cell comments, hyperlinks data validation, embedded formatting, charts, the auto filter can make the spreadsheet look like an advanced form. The user can add controls and other objects to the worksheet for much more convenience. For example, the user can create a list box to list the options available. The user can set properties such as it can either control floats freely or moves and resizes together with a cell.<\/p>\n<p><strong>For example:<\/strong><\/p>\n<p>The user might want a checkbox that would move together with the cell when the range is sorted. If the user has a list box then they might prefer to keep it in a specific location at all times instead of moving along with the cell.<\/p>\n<p>There are two types of controls and they are:<\/p>\n<ul>\n<li>Form controls<\/li>\n<li>ActiveX controls<\/li>\n<\/ul>\n<p><strong>Note<\/strong>: The user can add objects from the drawing tools such as shapes, text boxes, word art etc in addition to these controls.<\/p>\n<h4>VBA Form controls<\/h4>\n<p>The user can use Form controls when the user wants to interact with the cell data without using VBA code. The user can also use form controls when they want to add controls to chart sheets.<\/p>\n<p>For example: After adding a list box control to the spreadsheet and linking it to a cell, the user can return a numeric value for the current position of the selected item in the control. Then, that numeric value is accessed with the INDEX function to select different items from the list.<\/p>\n<p>The user can run macros by using Form controls and the user can also attach an existing macro to control or write or record a new macro. The control runs the macro when the user clicks the control.<\/p>\n<h4>VBA ActiveX controls<\/h4>\n<p>With or without the use of VBA code, and on VBA UserForms, the ActiveX controls are used on the spreadsheet forms. The ActiveX controls are used when the user needs more flexible design requirements. These controls have properties settings in which the user can access it to customize their appearance, behavior, fonts, and other characteristics.<\/p>\n<p>The user can also write macros that respond to events associated with ActiveX controls. While automating any application with VBA, the ActiveX controls are most frequently used controls. The user uses different ActiveX Controls in Excel spreadsheet or UserForm and performs various operations in Excel applications.<\/p>\n<p>Some of the ActiveX Controls are CheckBox, Label, Image, TextBox, ComboBox, ListBox, CommandButton, OptionButton etc.<\/p>\n<p><strong>For example: <\/strong><\/p>\n<p>The user can perform different actions, depending on which choice they select from a list box control.<\/p>\n<h3>Excel Form Control Vs ActiveX Control<\/h3>\n<p>Excel Form Control and Activex Control are almost alike but the applications vary a little between them.<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>FORM CONTROL<\/b><\/td>\n<td><b>ACTIVEX CONTROL<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Built-in feature in excel.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Sometimes, the user has to add it manually.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Much simpler and easy controls.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">More flexible designs are available than Form Control.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Available in Windows and as well as Mac.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Available only in windows.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">These controls are not used as objects in codes.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">These controls are used as objects in codes.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">The Form Control functionality cannot be extended.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The user can extend the functionality of the ActiveX controls by using the register custom under more controls.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">No property settings are available.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Properties settings are available.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">These controls respond after every update or editing on it.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The response to these controls are continuous<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>VBA Controls: VBA Form Control &amp; ActiveX Controls in Excel<\/h3>\n<h4>GUI controls in Excel<\/h4>\n<p>GUI stands for Graphical User Interface and it is a part of the program that the user interacts with. A GUI is made up of controls and these controls can be used in a Form by VBA excel. The most frequently used GUI VBA controls are:<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Control<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Command<\/span><\/td>\n<td><span style=\"font-weight: 400;\">These are used to execute the program<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Combo Box<\/span><\/td>\n<td><span style=\"font-weight: 400;\">These are used to create a drop down list.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Check Box<\/span><\/td>\n<td><span style=\"font-weight: 400;\">These are used to create the checkboxes and the user can choose one or more options.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">List Box<\/span><\/td>\n<td><span style=\"font-weight: 400;\">These are used to create lists<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Text Box<\/span><\/td>\n<td><span style=\"font-weight: 400;\">These are used to get user\u2019s input<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Scroll Bar<\/span><\/td>\n<td><span style=\"font-weight: 400;\">These are used to create scroll bars for navigation purposes.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Spin Button<\/span><\/td>\n<td><span style=\"font-weight: 400;\">By clicking on the up or down arrow, the user can increase or decrease the numeric values.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Option Button<\/span><\/td>\n<td><span style=\"font-weight: 400;\">These buttons can have only one true value at a time and these are mostly used for true or false purposes.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Label<\/span><\/td>\n<td><span style=\"font-weight: 400;\">These are used to display static text to the user.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Image<\/span><\/td>\n<td><span style=\"font-weight: 400;\">These are used to display images<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Toggle Button<\/span><\/td>\n<td><span style=\"font-weight: 400;\">These buttons have pressed and unpressed states.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>To access VBA GUI control, follow the steps:<\/h4>\n<p>Step 1: Go to the Developer tab<\/p>\n<p>Step 2: Choose the insert drop-down button.<\/p>\n<p>Step- 3: Choose a form control of your choice and these options are available in the drop down panel.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/ActiveX.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98124\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/ActiveX.png\" alt=\"ActiveX\" width=\"1600\" height=\"824\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/ActiveX.png 1600w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/ActiveX-768x396.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/ActiveX-1536x791.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/ActiveX-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/ActiveX-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/ActiveX-320x165.png 320w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/a><\/p>\n<p>Whenever the user plays the cursor on the VBA form controls, the name of the control appears.<\/p>\n<h4>Adding GUI controls to a spreadsheet<\/h4>\n<p>Let\u2019s now add a command button to the worksheet, follow the steps:<\/p>\n<p>Step 1: Go to the developer tab and Click on the Insert dropdown<\/p>\n<p>Step 2: Click on Command Button which is an ActiveX Control<\/p>\n<p>Step 3: Draw the button on the sheet as per the user\u2019s convenience.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/embed.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98071\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/embed.png\" alt=\"embed in VBA \" width=\"1920\" height=\"988\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/embed.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/embed-768x395.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/embed-1536x790.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/embed-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/embed-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/embed-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>Setting GUI control properties<\/h4>\n<p>Lets now set the caption of the button by following the steps:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/prop.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98072\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/prop.png\" alt=\"Properties in VBA Forms\" width=\"1920\" height=\"989\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/prop.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/prop-768x396.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/prop-1536x791.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/prop-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/prop-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/prop-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step 1: Right-click on the button<\/p>\n<p>Step 2: Choose Properties from the options available.<\/p>\n<p><strong>Note<\/strong>: A window appears containing the properties of the form control. The user uses the name property to identify the control in the code window.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/design.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98073\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/design.png\" alt=\"VBA Forms\" width=\"1920\" height=\"988\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/design.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/design-768x395.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/design-1536x790.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/design-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/design-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/design-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step 3: Let\u2019s now set the name property to btnButton.<br \/>\n<strong>Note<\/strong>: Button prefix is btn.<\/p>\n<p>Step 4: Let\u2019s now set the caption property to DataFlair. This is what the users will view on the button.<\/p>\n<p>Step 5: Close the window when you are done.<\/p>\n<p>The output will look like:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dataflair.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98074\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dataflair.png\" alt=\"VBA Controls\" width=\"1920\" height=\"988\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dataflair.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dataflair-768x395.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dataflair-1536x790.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dataflair-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dataflair-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dataflair-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h3>How to Use Form Control in Excel?<\/h3>\n<p>To use the form control in excel, go to the Developer tab and click the insert button. The list of form control appears. The first half of the list is the form controls.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/form-controls.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98075\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/form-controls.png\" alt=\"Form Controls in VBA\" width=\"955\" height=\"495\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/form-controls.png 955w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/form-controls-768x398.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/form-controls-720x373.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/form-controls-520x270.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/form-controls-320x166.png 320w\" sizes=\"auto, (max-width: 955px) 100vw, 955px\" \/><\/a><\/p>\n<p>The user can create different types of controls by just clicking on the item and dragging them to the sheet. After this, the user needs to connect the inserted form controls with the data and VBA code, the user may get some output.<\/p>\n<h3>How to create ActiveX control in VBA<\/h3>\n<p>Let\u2019s see how to incorporate the &#8216;command click&#8217; button in VBA using ActiveX control Excel. To execute a program, follow the steps:<\/p>\n<p>Step 1: Go to the Developer tab and click on the insert button.<\/p>\n<p>Step 2: Choose a button from the drop-down list and make sure the button you choose is under the activex controls.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/insert.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98076\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/insert.png\" alt=\"VBA Control forms\" width=\"1920\" height=\"984\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/insert.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/insert-768x394.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/insert-1536x787.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/insert-720x369.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/insert-520x267.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/insert-320x164.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step 3: Draw the button on the sheet as per the user\u2019s convenience.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/button.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98077\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/button.png\" alt=\"Button in VBA\" width=\"1920\" height=\"984\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/button.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/button-768x394.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/button-1536x787.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/button-720x369.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/button-520x267.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/button-320x164.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step 4: Now, right-click on the command button and choose the view code option from it.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98078\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box.png\" alt=\"view code text box\" width=\"953\" height=\"496\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box.png 953w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box-768x400.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box-720x375.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box-520x271.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box-320x167.png 320w\" sizes=\"auto, (max-width: 953px) 100vw, 953px\" \/><\/a><\/p>\n<p>Step 5: Enter your code once the code editor opens up.<br \/>\n<strong>Note<\/strong>: Before writing the code, check you are in the right sheet.<\/p>\n<p>Step 6: Copy-paste the following code in your editor.<\/p>\n<p><strong>Code to create an ActiveX Control Form:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Private Sub CommandButton1_Click()\r\n    Range(\"A1\").Value = \"DataFlair Tutorial\"\r\n    Range(\"A2\").Value = \"VBA Controls - DataFlair\"\r\nEnd Sub\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>Here, we define two strings to each cell in the worksheet. So, when the user clicks on the button, A1 will display DataFlair Tutorial and A2 will display VBA Controls &#8211; DataFlair<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-code.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98125\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-code.png\" alt=\"VBA code\" width=\"1600\" height=\"856\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-code.png 1600w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-code-768x411.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-code-1536x822.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-code-720x385.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-code-520x278.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-code-320x171.png 320w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/a><\/p>\n<p>Step 7: Save the code and then return to the excel file.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-code.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98079\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-code.png\" alt=\"cmd code\" width=\"1920\" height=\"1028\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-code.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-code-768x411.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-code-1536x822.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-code-720x386.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-code-520x278.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-code-320x171.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step 8: In the Excel sheet, check whether the design mode is on.<br \/>\n<strong>Note<\/strong>: If it appears as shown in the image, then turn off the design mode.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/commandbutton-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98128\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/commandbutton-1.png\" alt=\"command button in VBA\" width=\"1920\" height=\"990\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/commandbutton-1.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/commandbutton-1-768x396.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/commandbutton-1-1536x792.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/commandbutton-1-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/commandbutton-1-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/commandbutton-1-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step 9: Click on the Design mode to turn it off and then click on the button.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/vba-op.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98127\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/vba-op.png\" alt=\"VBA Output\" width=\"1600\" height=\"824\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/vba-op.png 1600w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/vba-op-768x396.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/vba-op-1536x791.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/vba-op-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/vba-op-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/vba-op-320x165.png 320w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/a><\/p>\n<p>The following output appears:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-out.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98080\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-out.png\" alt=\"cmd output\" width=\"1920\" height=\"984\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-out.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-out-768x394.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-out-1536x787.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-out-720x369.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-out-520x267.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/cmd-out-320x164.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h3>VBA Text Box<\/h3>\n<p>An empty field where the user can fill it with text or values is known as a text box. VBA TextBox is also a form control in Excel. This comes in handy when the user has to get the input from the other user such as name, date of birth etc.<\/p>\n<p>The textbox control helps the user to input the information and this saves more time and the errors while typing. It consists of static or dynamic data. Text box leads to a way to get data from the user and this paves a way to process the data and find out some useful insights out of it.<\/p>\n<h4>To create a textbox in Excel, follow the steps:<\/h4>\n<p>Step 1: Go to the Developer tab and click on the insert button.<\/p>\n<p>Step 2: Choose a textbox icon from the drop-down list and make sure the button you choose is under the activex controls.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/text-box.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98082\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/text-box.png\" alt=\"text box in VBA\" width=\"956\" height=\"500\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/text-box.png 956w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/text-box-768x402.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/text-box-720x377.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/text-box-520x272.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/text-box-320x167.png 320w\" sizes=\"auto, (max-width: 956px) 100vw, 956px\" \/><\/a><\/p>\n<p>Step 3: Draw the button on the sheet as per the user\u2019s convenience.<\/p>\n<p>Step &#8211; 4: Right-click on the command button and select view code.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98083\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box-1.png\" alt=\"view code text box\" width=\"953\" height=\"496\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box-1.png 953w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box-1-768x400.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box-1-720x375.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box-1-520x271.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-text-box-1-320x167.png 320w\" sizes=\"auto, (max-width: 953px) 100vw, 953px\" \/><\/a><\/p>\n<p>Note: The user can change the caption and name of a control by right-clicking on the control and then selecting the Properties option. Here, TextBox1 is the name of the text box.<\/p>\n<p>Step -5: Copy paste the following code in your editor.<\/p>\n<p><strong>Code to create a TextBox:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Private Sub TextBox1_Change()\r\nTextBox1.Text = \"DataFlair Website!\"\r\nEnd Sub\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><br \/>\nHere, the user is adding the content to the text box. The content that will appear in the text box is \u201cDataFlair Website!\u201d<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/code-tb.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98084\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/code-tb.png\" alt=\"Code Text Box in VBA\" width=\"1920\" height=\"1000\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/code-tb.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/code-tb-768x400.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/code-tb-1536x800.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/code-tb-720x375.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/code-tb-520x271.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/code-tb-320x167.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step &#8211; 6: Save and run the code. The following output appear in the sheet:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/tb-op.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98085\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/tb-op.png\" alt=\"VBA Text Box Output\" width=\"1920\" height=\"991\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/tb-op.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/tb-op-768x396.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/tb-op-1536x793.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/tb-op-720x372.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/tb-op-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/tb-op-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step &#8211; 7: To clear the text in the text box, change the code in the editor as follows<\/p>\n<p><strong>Code to clear the text in the TextBox:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">TextBox1.Value = \"\"<\/pre>\n<p>Note: The textbox is very much helpful in a userform and sometimes, the user can use it to directly place a text box on the worksheet.<\/p>\n<h3>VBA List Box<\/h3>\n<p>List box is also a tool under the user forms in VBA. The list box comes with a user form in VBA. The list box can hold a list of values in it and the user can select an item from the Listbox. An empty field where the user can fill it with a list of items is known as a list box. To create a Listbox in Excel, follow the steps:<\/p>\n<p>Step 1: Go to the Developer tab and click on the insert button.<\/p>\n<p>Step 2: Choose a Listbox icon from the drop-down list and make sure the button you choose is under the activex controls.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-icon.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98086\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-icon.png\" alt=\"list box icon\" width=\"953\" height=\"497\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-icon.png 953w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-icon-768x401.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-icon-720x375.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-icon-520x271.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-icon-320x167.png 320w\" sizes=\"auto, (max-width: 953px) 100vw, 953px\" \/><\/a><\/p>\n<p>Step 3: Draw the button on the sheet as per the user\u2019s convenience.<\/p>\n<p>Step &#8211; 4: Right-click on the command button and select view code.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-view.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98087\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-view.png\" alt=\"list box view\" width=\"946\" height=\"469\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-view.png 946w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-view-768x381.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-view-720x357.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-view-520x258.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/list-box-view-320x159.png 320w\" sizes=\"auto, (max-width: 946px) 100vw, 946px\" \/><\/a><\/p>\n<p>Note: The user can change the caption and name of a control by right-clicking on the control and then selecting the Properties option. Here, the ListBox1 is the name of the list box.<\/p>\n<p>Step -5: Copy paste the following code in your editor.<\/p>\n<p><strong>Code to create a ListBox:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Private Sub ListBox1_Click()\r\nWith Sheet3.ListBox1\r\n    .AddItem \"Excel\"\r\n    .AddItem \"VBA\"\r\n    .AddItem \"Python\"\r\nEnd With\r\nEnd Sub\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><br \/>\nHere, the user is adding a list of items to the list box. The content that will appear in the listbox are \u201cExcel\u201d, \u201cVBA\u201d, \u201cPython\u201d.<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/listbox-code.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98088\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/listbox-code.png\" alt=\"listbox code\" width=\"1920\" height=\"1000\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/listbox-code.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/listbox-code-768x400.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/listbox-code-1536x800.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/listbox-code-720x375.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/listbox-code-520x271.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/listbox-code-320x167.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step &#8211; 6: Save and run the code. The following output appears in the sheet:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/lb-op.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98089\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/lb-op.png\" alt=\"Listbox in VBA\" width=\"1920\" height=\"989\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/lb-op.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/lb-op-768x396.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/lb-op-1536x791.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/lb-op-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/lb-op-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/lb-op-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step &#8211; 7: To clear the list items in the list box, change the code in the editor as follows<\/p>\n<p><strong>Code to clear the list items:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">ListBox1.Clear<\/pre>\n<p>Note: The listbox is very much helpful in a userform and sometimes, the user can use it to directly place a list item on the worksheet.<\/p>\n<h3>VBA Combo Box<\/h3>\n<p>A drop-down list from which a user can select an item to fill their choice is known as combo box. To create a combo box, follow the steps:<\/p>\n<p>Step 1: Go to the Developer tab and click on the insert button.<\/p>\n<p>Step 2: Choose a combo box icon from the drop-down list and make sure the button you choose is under the ActiveX controls.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-icon.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98090\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-icon.png\" alt=\"combo icon\" width=\"958\" height=\"492\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-icon.png 958w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-icon-768x394.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-icon-720x370.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-icon-520x267.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-icon-320x164.png 320w\" sizes=\"auto, (max-width: 958px) 100vw, 958px\" \/><\/a><\/p>\n<p>Step 3: Draw the button on the sheet as per the user\u2019s convenience.<\/p>\n<p>Step 4: Right-click on the command button and select view code.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-combo-box.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98091\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-combo-box.png\" alt=\"view code combo box\" width=\"955\" height=\"493\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-combo-box.png 955w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-combo-box-768x396.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-combo-box-720x372.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-combo-box-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/view-code-combo-box-320x165.png 320w\" sizes=\"auto, (max-width: 955px) 100vw, 955px\" \/><\/a><\/p>\n<p><strong>Note<\/strong>: The user can change the caption and name of a control by right clicking on the control and then selecting the Properties option. Here, the ComboBox1 is the name of the combo box.<\/p>\n<p>Step 5: Copy-paste the following code in your editor.<\/p>\n<p><strong>Code to add a ComBox in the Excel Sheet:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Private Sub ComboBox1_Change()\r\nWith Sheet4.ComboBox1\r\n    .AddItem \"Excel\"\r\n    .AddItem \"Python\"\r\n    .AddItem \"Java\"\r\nEnd With\r\nEnd Sub\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><br \/>\nHere, the user is adding a drop-down list of items to the combo box. The content that will appear in the combo box is \u201cExcel\u201d, \u201cPython\u201d, \u201cJava\u201d.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-code.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98092\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-code.png\" alt=\"combo code\" width=\"1920\" height=\"1002\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-code.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-code-768x401.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-code-1536x802.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-code-720x376.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-code-520x271.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-code-320x167.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step &#8211; 6: Save and run the code. The following output appears in the sheet:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-op.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98093\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-op.png\" alt=\"Combo Output\" width=\"953\" height=\"496\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-op.png 953w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-op-768x400.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-op-720x375.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-op-520x271.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/combo-op-320x167.png 320w\" sizes=\"auto, (max-width: 953px) 100vw, 953px\" \/><\/a><\/p>\n<p>Step &#8211; 7: To clear the combo list items in the list box, change the code in the editor as follows<\/p>\n<p><strong>Code to clear the combo list items:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">ComboBox1.Clear\r\nComboBox1.Value = \"\"\r\n<\/pre>\n<p>Note: The combo box is very much helpful for a userform and sometimes, the user can use it to directly place a drop-down combo list item on the worksheet.<\/p>\n<h3>VBA Check Box<\/h3>\n<p>A field where the information is stored to check it is known as a checkbox. To create a checkbox, follow the steps:<br \/>\nStep 1: Go to the Developer tab and click on the insert button.<\/p>\n<p>Step 2: Choose the checkbox icon from the drop-down list and make sure the button you choose is under the ActiveX controls.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-box-icon.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98094\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-box-icon.png\" alt=\"check box icon\" width=\"948\" height=\"479\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-box-icon.png 948w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-box-icon-768x388.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-box-icon-720x364.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-box-icon-520x263.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-box-icon-320x162.png 320w\" sizes=\"auto, (max-width: 948px) 100vw, 948px\" \/><\/a><\/p>\n<p>Step 3: Draw the button on the sheet as per the user\u2019s convenience.<\/p>\n<p>Step &#8211; 4: Right-click on the command button and select view code.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-view.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98095\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-view.png\" alt=\"Check Box View Code\" width=\"953\" height=\"481\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-view.png 953w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-view-768x388.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-view-720x363.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-view-520x262.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/check-view-320x162.png 320w\" sizes=\"auto, (max-width: 953px) 100vw, 953px\" \/><\/a><\/p>\n<p>Note: The user can change the caption and name of a control by right-clicking on the control and then selecting the Properties option. Here, CheckBox1 is the name of the check box.<\/p>\n<p>Step -5: Copy paste the following code in your editor.<\/p>\n<p><strong>CheckBox Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Private Sub CheckBox1_Click()\r\nIf CheckBox1.Value = True Then Range(\"A1\").Value = \"DataFlair\"\r\nIf CheckBox1.Value = False Then Range(\"A1\").Value = \"No Article Available\"\r\nEnd Sub\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><br \/>\nHere, the user is adding a checkbox and if the checkbox is marked, \u201cDataFlair\u201d appears in the A1 cell. If the checkbox is not marked, then \u201cNo Article Available\u201d appears in the A2 cell.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chk-box-code.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98096\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chk-box-code.png\" alt=\"Check Box Code\" width=\"1920\" height=\"992\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chk-box-code.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chk-box-code-768x397.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chk-box-code-1536x794.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chk-box-code-720x372.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chk-box-code-520x269.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chk-box-code-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step &#8211; 6: Save and run the code. The following output appears in the sheet:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chck-box-op.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98097\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chck-box-op.png\" alt=\"Check Box Output\" width=\"1399\" height=\"932\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chck-box-op.png 1399w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chck-box-op-768x512.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chck-box-op-720x480.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chck-box-op-520x346.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chck-box-op-320x213.png 320w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/chck-box-op-272x182.png 272w\" sizes=\"auto, (max-width: 1399px) 100vw, 1399px\" \/><\/a><\/p>\n<p>Note: The checkbox is very much helpful in a userform and sometimes, the user can use it to directly place a drop down combo list item on the worksheet.<\/p>\n<h3>VBA Option Buttons<\/h3>\n<p>The user uses the option button when there are multiple options but only one has to be selected. To create an option button, follow the steps:<\/p>\n<p>Step 1: Go to the Developer tab and click on the insert button.<\/p>\n<p>Step 2: Choose the option button icon from the drop-down list and make sure the button you choose is under the ActiveX controls.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-icon.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98098\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-icon.png\" alt=\"option button icon\" width=\"952\" height=\"482\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-icon.png 952w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-icon-768x389.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-icon-720x365.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-icon-520x263.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-icon-320x162.png 320w\" sizes=\"auto, (max-width: 952px) 100vw, 952px\" \/><\/a><\/p>\n<p>Step 3: Draw the button on the sheet as per the user\u2019s convenience.<\/p>\n<p>Step &#8211; 4: Right-click on the command button and select view code.<br \/>\nNote: Add as many as button required. Here, we have two options buttons in the sheet.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-view.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98099\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-view.png\" alt=\"option button view\" width=\"944\" height=\"497\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-view.png 944w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-view-768x404.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-view-720x379.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-view-520x274.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/option-button-view-320x168.png 320w\" sizes=\"auto, (max-width: 944px) 100vw, 944px\" \/><\/a><\/p>\n<p>Note: The user can change the caption and name of a control by right-clicking on the control and then selecting the Properties option. Here, OptionButton1 is the name of the option button1 and OptionButton2 is the name of the option button2.<\/p>\n<p>Step -5: Copy paste the following code in your editor.<\/p>\n<p><strong>Code to add Option Button:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Private Sub OptionButton1_Click()\r\nIf OptionButton1.Value = True Then Range(\"A1\").Value = \"DataFlair\"\r\nEnd Sub\r\n \r\nPrivate Sub OptionButton2_Click()\r\nIf OptionButton2.Value = True Then Range(\"A2\").Value = \"DataFlair Excel\"\r\nEnd Sub<\/pre>\n<p><strong>Code Explanation:<\/strong><br \/>\nHere, if the user clicks on the first option button then \u201cDataFlair\u201d appears in the A1 cell or else if the user clicks on the second option button then \u201cDataFlair Excel\u201d appears in the A2 cell.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-code.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98100\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-code.png\" alt=\"Option Code\" width=\"1920\" height=\"990\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-code.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-code-768x396.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-code-1536x792.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-code-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-code-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-code-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step &#8211; 6: Save and run the code. The following output appears in the sheet:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-op.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98101\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-op.png\" alt=\"Option Button Output\" width=\"1920\" height=\"999\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-op.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-op-768x400.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-op-1536x799.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-op-720x375.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-op-520x271.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/opt-op-320x167.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Note: The option box is very helpful in a userform and sometimes, the user can use it to directly place a drop down combo list item on the worksheet.<\/p>\n<h3>VBA Spin Button<\/h3>\n<p>The user uses the spin button to increase a number in the cell. To create a spin button, follow the steps:<br \/>\nStep 1: Go to the developer tab and click on the insert button.<\/p>\n<p>Step 2: Choose the spin button icon from the drop down list and make sure the button you choose is under the activex controls.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-icon.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98102\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-icon.png\" alt=\"spin icon in VBA\" width=\"958\" height=\"497\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-icon.png 958w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-icon-768x398.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-icon-720x374.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-icon-520x270.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-icon-320x166.png 320w\" sizes=\"auto, (max-width: 958px) 100vw, 958px\" \/><\/a><\/p>\n<p>Step 3: Draw the button on the sheet as per the user\u2019s convenience.<\/p>\n<p>Step &#8211; 4: Right-click on the command button and select view code.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-view.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98103\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-view.png\" alt=\"spin view\" width=\"958\" height=\"498\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-view.png 958w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-view-768x399.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-view-720x374.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-view-520x270.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-view-320x166.png 320w\" sizes=\"auto, (max-width: 958px) 100vw, 958px\" \/><\/a><\/p>\n<p>Note: The user can change the caption and name of a control by right clicking on the control and then selecting the Properties option. Here, the SpinButton1 is the name of the spin button.<\/p>\n<p>Step -5: Copy paste the following code in your editor.<\/p>\n<p><strong>Code to add Spin Button in Excel:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Private Sub SpinButton1_Change()\r\nRange(\"A1\").Value = SpinButton1.Value\r\nSpinButton1.Max = 50\r\nSpinButton1.Min = 0\r\nSpinButton1.SmallChange = 5\r\nEnd Sub\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><br \/>\nHere, when the user presses on the right side arrow, the value increases by 5. If the user presses the left side arrow, the value decreases by 5. Initially, the A1 value is set upto 0.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-code.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98104\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-code.png\" alt=\"VBA Spin Code\" width=\"1920\" height=\"1003\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-code.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-code-768x401.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-code-1536x802.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-code-720x376.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-code-520x272.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-code-320x167.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Step &#8211; 6: Save and run the code. The following output appears in the sheet:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-op.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98105\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-op.png\" alt=\"Spin Output\" width=\"1920\" height=\"990\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-op.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-op-768x396.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-op-1536x792.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-op-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-op-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/spin-op-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h3>Prerequisite<\/h3>\n<ul>\n<li>Make sure you have a Microsoft Excel and save the workbook as an Excel Macro-Enabled Workbook file extension.<\/li>\n<li>Make sure the ribbon contains the developer tab.<\/li>\n<\/ul>\n<h3>Pros of Form Controls<\/h3>\n<ul>\n<li>The controls in the forms are easy to implement.<\/li>\n<li>Selecting the range and cell link in the control option is almost the same and it&#8217;s easy to implement by the user.<\/li>\n<\/ul>\n<h3>Things to Remember<\/h3>\n<ul>\n<li>ActiveX controls are utilized by the macros.<\/li>\n<li>Both macros and manual data can use the form controls.<\/li>\n<li>The form controls are also customizable.<\/li>\n<li>The form controls are also used with the charts in excel.<\/li>\n<\/ul>\n<h3>Summary<\/h3>\n<p>Graphical User Interface plays a huge part of the program to interact with the user and they are made up of controls.<br \/>\nThe checkbox, Listbox, command, textbox are some of the few controls which are commonly used in the VBA forms.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is a VBA form? A form is a document designed with a format to collect, organize and edit information. There are two types of forms. Printed Forms Online Forms Printed Forms: These are&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":98066,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24129],"tags":[24749,24747,24748],"class_list":["post-97896","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ms-excel","tag-vba-activex-controls","tag-vba-controls","tag-vba-form-controls"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>VBA Controls - Form Control &amp; ActiveX Control in Excel - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn about VBA Controls - Form control &amp; ActiveX Control. Learn their pros and cons, Use of Form Control in Excel and ActiveX control in VBA\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/vba-controls\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"VBA Controls - Form Control &amp; ActiveX Control in Excel - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn about VBA Controls - Form control &amp; ActiveX Control. Learn their pros and cons, Use of Form Control in Excel and ActiveX control in VBA\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/vba-controls\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-16T03:30:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-Controls-VBA-Form-Control-ActiveX-Controls-in-Excel.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"22 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"VBA Controls - Form Control & ActiveX Control in Excel - DataFlair","description":"Learn about VBA Controls - Form control & ActiveX Control. Learn their pros and cons, Use of Form Control in Excel and ActiveX control in VBA","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/vba-controls\/","og_locale":"en_US","og_type":"article","og_title":"VBA Controls - Form Control & ActiveX Control in Excel - DataFlair","og_description":"Learn about VBA Controls - Form control & ActiveX Control. Learn their pros and cons, Use of Form Control in Excel and ActiveX control in VBA","og_url":"https:\/\/data-flair.training\/blogs\/vba-controls\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-07-16T03:30:24+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-Controls-VBA-Form-Control-ActiveX-Controls-in-Excel.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"22 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/vba-controls\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/vba-controls\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9"},"headline":"VBA Controls &#8211; Form Control &#038; ActiveX Control in Excel","datePublished":"2021-07-16T03:30:24+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/vba-controls\/"},"wordCount":3133,"commentCount":1,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/vba-controls\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-Controls-VBA-Form-Control-ActiveX-Controls-in-Excel.jpg","keywords":["VBA ActiveX Controls","VBA Controls","VBA Form Controls"],"articleSection":["MS Excel Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/vba-controls\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/vba-controls\/","url":"https:\/\/data-flair.training\/blogs\/vba-controls\/","name":"VBA Controls - Form Control & ActiveX Control in Excel - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/vba-controls\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/vba-controls\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-Controls-VBA-Form-Control-ActiveX-Controls-in-Excel.jpg","datePublished":"2021-07-16T03:30:24+00:00","description":"Learn about VBA Controls - Form control & ActiveX Control. Learn their pros and cons, Use of Form Control in Excel and ActiveX control in VBA","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/vba-controls\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/vba-controls\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/vba-controls\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-Controls-VBA-Form-Control-ActiveX-Controls-in-Excel.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/VBA-Controls-VBA-Form-Control-ActiveX-Controls-in-Excel.jpg","width":1200,"height":628,"caption":"VBA Controls VBA Form Control & ActiveX Controls in Excel"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/vba-controls\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"MS Excel Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/ms-excel\/"},{"@type":"ListItem","position":3,"name":"VBA Controls &#8211; Form Control &#038; ActiveX Control in Excel"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team is a group of passionate educators and industry experts dedicated to providing high-quality online learning resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With years of experience in the field, the team aims to simplify complex topics and help learners advance their careers. At DataFlair, we believe in empowering students and professionals with the knowledge and skills needed to thrive in today\u2019s fast-paced tech industry. Follow us for Free courses, expert insights, tutorials, and practical tips to boost your learning journey.","url":"https:\/\/data-flair.training\/blogs\/author\/datafbdad\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/97896","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=97896"}],"version-history":[{"count":5,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/97896\/revisions"}],"predecessor-version":[{"id":98129,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/97896\/revisions\/98129"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/98066"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=97896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=97896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=97896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}