How To Insert Checkbox In Excel 2016 For Mac
Each Excel dialog box that you create in VBA is stored in its own UserForm object — one dialog box per UserForm. You create and access these UserForms in the Visual Basic Editor.
Inserting a new UserForm
In Excel, a checkbox is an interactive tool that can be used to select or deselect an option. You must have seen it in many web form available online.
Insert a UserForm object by following these steps:
Activate the VBE by pressing Alt+F11.
Select the workbook that will hold the UserForm in the Project window.
Choose Insert → UserForm.
The VBE inserts a new UserForm object, which contains an empty dialog box.
Here is a UserForm — an empty dialog box. Your job, if you choose to accept it, is to add some controls to this UserForm.
Adding controls to a UserForm
When you activate a UserForm, the VBE displays the Toolbox in a floating window. You use the tools in the Toolbox to add controls to your UserForm. If, for some reason, the Toolbox doesn’t appear when you activate your UserForm, choose View → Toolbox.
To add a control, just click the desired control in the Toolbox and drag it into the dialog box to create the control. After you add a control, you can move and resize it by using standard techniques.
Here is a list of the various tools, as well as their capabilities.
Control | What It Does |
---|---|
Label | Shows text |
TextBox | Allows the user to enter text |
ComboBox | Displays a drop-down list |
ListBox | Displays a list of items |
CheckBox | Provides options such as on/off or yes/no |
OptionButton | Allows the user to select one of several options; used in groups of two or more |
ToggleButton | Enables the user to switch a button on or off |
Frame | Contains other controls |
CommandButton | A clickable button |
TabStrip | Displays tabs |
MultiPage | A tabbed container for other objects |
ScrollBar | Enables the user to drag a bar to establish a setting |
SpinButton | Enables the user to click a button to change a value |
Image | Holds an image |
RefEdit | Allows the user to select a range |
Changing properties for a UserForm control
Every control you add to a UserForm has properties that determine how the control looks or behaves. In addition, the UserForm itself has its own set of properties. You can change these properties with the aptly named Properties window. This shows the Properties window when a CommandButton control is selected.
The Properties window appears when you press F4, and the properties shown in this window depend on what is selected. If you select a different control, the properties change to those appropriate for that control. To hide the Properties window and get it out of the way, click the Close button in its title bar. Pressing F4 always brings it back when you need it.
Properties for controls include the following:
Name
Width
Height
Value
Caption
This is usually installed in your computer. This device allows you to connect to wireless networks. What is an N wireless adapter?-Wireless-N the 802.11n standard will be the next generation of high-speed Wi-Fi capable of delivering the range and capacity. What is the recommended distance of Wireless-N USB Network Adapter from the. Request for Drivers & Manual. Drivers: 562 Manuals: 549. Technical Hotline: 02-666-4568 02-413-9788 For Router Assistance: 02-362-0393. 2.4GHz Wireless-N USB Network Adapter (150 Mbps) WL0213. Wireless-N LAN PCI Card. WU-NETA-005-ZI (WL0183) Wireless-N USB Network Adapter (150Mbps) WL0179. Wireless-N USB Network Adapter (150Mbps). Usb wifi dongle 150mbps driver.
Each control has its own set of properties (although many controls have some common properties). To change a property using the Properties window, follow these steps:
Make sure that the correct control is selected in the UserForm.
Make sure the Properties window is visible.
In the Properties window, click the property that you want to change.
Make the change in the right portion of the Properties window.
If you select the UserForm itself (not a control on the UserForm), you can use the Properties window to adjust UserForm properties.
Viewing the UserForm Code window
Every UserForm object has a Code module that holds the VBA code (the event-handler procedures) that is executed when the user works with the dialog box. To view the Code module, press F7. The Code window is empty until you add some procedures. Press Shift+F7 to return to the dialog box.
Here’s another way to switch between the Code window and the UserForm display: Use the View Code and View Object buttons in the Project window’s title bar. Or right-click the UserForm and choose View Code. If you’re viewing code, double-click the UserForm name in the Project window to return to the UserForm.
Displaying a UserForm
You display a UserForm by using the UserForm’s Show method in a VBA procedure.
The macro that displays the dialog box must be in a VBA module — not in the Code window for the UserForm.
The following procedure displays the dialog box named UserForm1:
When Excel displays the dialog box, the ShowDialogBox macro halts until the user closes the dialog box. Then VBA executes any remaining statements in the procedure. Most of the time, you won’t have any more code in the procedure. As you later see, you put your event-handler procedures in the Code window for the UserForm. These procedures kick in when the user works with the controls on the UserForm.
Using information from a UserForm
The VBE provides a name for each control you add to a UserForm. The control’s name corresponds to its Name property. Use this name to refer to a particular control in your code. For example, if you add a CheckBox control to a UserForm named UserForm1, the CheckBox control is named CheckBox1 by default. You can use the Properties box to make this control appear with a check mark. Or you can write code to do it:
Most of the time, you write the code for a UserForm in the UserForm’s code module. If that’s the case, you can omit the UserForm object qualifier and write the statement like this:
Your VBA code can also check various properties of the controls and take appropriate actions. The following statement executes a macro named PrintReport if the check box (named CheckBox1) is checked:
It’s usually a good idea to change the default name the VBE has given to your controls to something more meaningful.
Knowing how to make checkboxes in Excel 2011 for Mac is a handy bit of know-how. Check boxes appear in all kinds of forms, such as surveys and questionnaires, where you choose from multiple answers. In Excel 2011 for Mac, each check box control is linked to a cell on your worksheet.
To make a check box in Excel 2011 for Mac, take these steps:
While your form is unprotected, click the Check Box control on the Developer tab of the Ribbon.
Drag diagonally and then let go of the mouse.
A check box appears and is selected on your worksheet.
Right-click the new button and choose Format Control from the pop-up menu.
On the Control tab of the Format control dialog, set a cell link by clicking into the empty Cell Link field and then clicking a cell on any worksheet.
The linked cell is indicated in the Cell Link field in the dialog.
Unlock the linked cell.
The control won’t work when you protect the worksheet unless you unlock the linked cell. Adjust other formatting options as desired. Repeat Steps 1 through 4 for each Check Box control you want to add to your worksheet.
To prevent a user from tabbing into a linked cell, put the linked cell in a hidden row or column, or on another worksheet.
Click OK to close the Format Control dialog.
When the check box control is selected, the linked cell’s value is TRUE. When the control is deselected, the linked cell’s value is FALSE. You can set the initial value in the Format Control dialog. If you choose an initial setting of Mixed, the linked cell’s value displays #N/A until the check box is clicked in the form.
The default text when you make a check box is its official name, which will be something like Check Box 4. Change the default text by clicking into the text inside the control and then dragging over the text to select it. Then type replacement text. Typing replacement text to display does not change the control’s name.