返回列表 上一主題 發帖

[發問] 關於資料寫入儲存格的方式

Private Sub CommandButton1_Click()
Dim PassWD, xE1 As Range, xE2 As Range, T$
If TextBox1 = "" Then MsgBox "請輸入ID": Exit Sub
If TextBox2 = "" Then MsgBox "請輸入密碼": Exit Sub
 
Set xE1 = [交接事項!A65536].End(xlUp)(2)
Set xE2 = [交接事項!I65536].End(xlUp)(2)
 
PassWD = Application.VLookup(TextBox1, [Sheet3!E:F], 2, 0)
If IsError(PassWD) Then T = "ID錯誤"
If T = "" Then If PassWD & "" <> TextBox2.Text Then T = "密碼錯誤"
If T <> "" Then
  xE2.Resize(1, 4) = Array(Date, Time, TextBox1, T):  MsgBox T: GoTo 999
End If
 
xE1.Resize(1, 3) = Array(Date, Time, TextBox1): MsgBox "登入成功"
 
999:
If xE1.Row > 4500 Or xE2.Row > 4500 Then MsgBox "記錄量過大,請清理舊記錄!"
End Sub
 

====================================
TextBox2 的〔屬性.PasswordChar〕設為 "*",字設〔黑色〕,
輸入密碼時,自動顯示為〔****〕

TOP

        靜思自在 : 修行要繫緣修心,藉事練心,隨處養心。
返回列表 上一主題