建两个控件,如图:
写代码:
Private Sub CommandButton1_Click() Dim x For x = 1 To ListBox1.ListCount If ListBox1.Selected(x) = True Then ListBox1.Selected(x) = False Next x End SubPrivate Sub UserForm_Activate() ListBox1.List = Range("a1:a5").ValueEnd Sub