Untitled
unknown
plain_text
8 days ago
1.2 kB
2
Indexable
Private Sub Login_Click() Dim sh As Worksheet Set sh = ThisWorkbook.Sheets("USER MANAGEMENT") If Me.txt_Username.Value = "" Then MsgBox "Please Enter your user Name", vbcriticl Exit Sub End If If Me.txt_Password.Value = "" Then MsgBox "Please Enter your Password", vbcriticl Exit Sub End If If Application.WorksheetFunction.CountIf(sh.Range("A:A"), Me.txt_Username.Value) = 0 Then MsgBox "Invalid User Name, vbcritical" Exit Sub Dim user_row As Integer user_row = Application.WorksheetFunction.Match(Me.txt_Username.Value, sh.Range("A:A"), 0) If Me.txt_Password.Value <> sh.Range("C" & user_row).Value Then MsgBox "Invalid Password, vbcritical" Exit Sub End If Dim lock_worksheet, unlock_worksheet As Integer lock_worksheet = Application.WorksheetFunction.CountIf(sh.Range("E" & user_row, "XFD" & user_row), "Ï") unlock_worksheet = Application.WorksheetFunction.CountIf(sh.Range("E" & user_row, "XFD" & user_row), "Ð") If (lock_worksheet + unlock_worksheet) = 0 Then MsgBox "You Dont have the access for any worksheet, please contact with your Admin", vbCritical Exit Sub End If ''''''''apply setting End If End Sub
Editor is loading...
Leave a Comment