|
Private Sub UserForm_Activate()
ARR = Sheet002.Range("A3:CA" & Sheet002.Range("A65536").End(3).Row)
TextBox1.Text = ""
For i = 2 To UBound(ARR)
ComboBox1.AddItem ARR(i, 1)
Next
End Sub
Private Sub CommandButton2_Click()
Unload UserForm1
End Sub
Private Sub CommandButton1_Click() '登录按钮
For i = 2 To UBound(ARR)
If ComboBox1.Text = ARR(i, 1) And TextBox1.Text = ARR(i, 2) Then
C = Sheet002.Cells(3, 100).End(xlToLeft).Column
For j = 3 To C
If ARR(i, j) Then Sheets(ARR(1, j)).Visible = True
Next
MsgBox ComboBox1.Text & "你好!欢迎你进入本系统", 1 + 64, "博瑞集团"
Application.Visible = True
Unload UserForm1
Exit Sub
End If
Next
MsgBox "用户名或密码输入错误,请重新输入!", vbOKOnly + vbExclamation, "错误"
TextBox1 = ""
End Sub
改成这样,如果增加表格不需要再改代码
|
|