Check Box

Use the CheckBox control to determine if an item is selected (see Figure 3-18). If the box is unchecked, then the item isn't selected. If the box is checked, then the user has selected that item. You may have any number of CheckBox controls on a UserForm; each CheckBox control's checked state is independent of any other CheckBox control.

Figure 3-16. A UserForm with a ComboBox control
Figure 3-17. A UserForm with a ListBox control

The following example uses the Click event of the CheckBox control to determine the current state of the control:

Private Sub CheckBox1_Click() If CheckBox1.Value Then MsgBox "Checked"

Else

MsgBox "Unchecked" End If End Sub

Was this article helpful?

0 0

Post a comment