|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Private Sub CommandButton1_Click()
Dim zh As Range
If Len(ComboBox1.Text) = 0 Then MsgBox "未输入账号,请输入正确账号": Exit Sub
If Len(TextBox1.Text) = 0 Then MsgBox "未输入账号,请输入密码": Exit Sub
Set zh = Sheets("账号").Range("a:a").Find(ComboBox1.Text, , , 1)
If Not zh Is Nothing Then
If zh.Offset(0, 1) <> TextBox1.Text Then
MsgBox "密码错误,如忘记密码请联系管理员"
Exit Sub
Else
MsgBox "欢迎进入预算管理系统!"
权限 (ComboBox1.Text)
Application.Visible = True
Unload Me
End If
Else
MsgBox "账号不存在"
End If
End Sub
Private Sub UserForm_Initialize()
With Sheets("账号")
r = .Cells(Rows.Count, 1).End(xlUp).Row
ar = .Range("a2:a" & r)
End With
Me.ComboBox1.List = ar
End Sub
|
|