excel VBA基础登陆实验
Private Sub CommandButton1_Click()
Dim myarea As Range
Dim key As String
key = ComboBox_name.SelText
Set myarea = Sheets("sheet1").Columns(1).Find(key)
If myarea.Rows.Count > 0 Then
If myarea.Offset(0, 1).Value = TextBox_un.Text Then
MsgBox "登陆成功!"
login.Hide '隐藏窗口
Else
MsgBox "用户名或密码错误!"
End If
End If
End Sub