|
Sub cc()
Dim i&, j&, k&, arr, brr, sh As Object, n&
If n >= 3 Then
MsgBox "非法操作!", 16, App.Title
End
End If
If TextBox1 = Box1 And TextBox2 = Box2 Then '能够登录成功
Set sh = GetObject(ThisWorkbook.Path + "\..\练习3.xls")
arr = Range("a2:f" & [a65536].End(xlUp).Row)
brr = sh.Worksheets("表2").Range("a2:f" & sh.Worksheets("表2").[a65536].End(xlUp).Row)
For i = 1 To UBound(arr)
For j = 2 To 6
For k = 1 To UBound(brr)
If arr(i, 1) = brr(k, 1) And arr(1, j) = brr(k, 2) Then
arr(i, j) = brr(k, 3)
End If
Next k, j, i
[a2].Resize(UBound(arr), 6) = arr
Set sh = Nothing
Else
MsgBox "密码或者用户名输入错误,再试一次!", 48
n = n + 1
End If
End Sub |
|