nnsea 发表于 2023-10-26 12:08:26

InputBox登陆密码实例


Sub test()
1:
n = n + 1
If n > 3 Then Exit Sub
user = InputBox("请输入用户名", "用户")
If user = "" Then MsgBox "用户名不能为空": GoTo 1
Set yh = Sheet1.Range("a:a").Find(user, , , xlWhole)
'MsgBox yh.Offset(0, 1).Value
If yh Is Nothing Then
GoTo 1
End If

2:
m = m + 1
If m > 3 Then Exit Sub
pass = InputBox("请输入密码", "密码")
If pass = "" Then MsgBox "密码不能为空": GoTo 2
If pass * 1 <> yh.Offset(0, 1).Value Then
GoTo 2
End If
MsgBox "登录成功"
End Sub
页: [1]
查看完整版本: InputBox登陆密码实例