Hi
i am quite new to vba. i am trying to create a login/register screen. My motive is to
a) Encrypt the password in the Password textfield in the userform but when it is stored in the excel sheet, it should be decrypted
b)here is a piece of code . Whatever Login ID i give, it always says "Userlogin is already present. Please use some other login"
Private Sub rgcmdbtsv_Click()
Dim insertrow As Integer
Dim i As Integer, Message As Integer
'Dim wspwd As Sheets
'Set wspwd = Worksheets("Passwords")
insertrow = Worksheets("Passwords").UsedRange.Rows.Count + 1
If insertrow > 1 Then
For i = 2 To insertrow - 1
If StrComp(rgtxtbxlid.Value, Worksheets("Passwords").Cells(insertrow, 2).Value, vbTextCompare) = 0 Then
Message = MsgBox("Userlogin is already present. Please use some other login", vbOK, "Try again")
rgtxtbxlid.Value = ""
Exit For
ElseIf rgtxtbxnm.Value = "" Then
Message = MsgBox("Name cannot be null", vbOK, "Try Again")
Exit For
ElseIf rgtxtbxlid.Value = "" Then
Message = MsgBox("Login ID cannot be null", vbOK, "Try Again")
Exit For
ElseIf rgtxtbxpwd.Value = "" Then
Message = MsgBox("Password cannot be null", vbOK, "Try Again")
Exit For
Else
Worksheets("Passwords").Cells(insertrow, 1) = rgtxtbxnm.Value
Worksheets("Passwords").Cells(insertrow, 2) = rgtxtbxlid.Value
Worksheets("Passwords").Cells(insertrow, 3) = rgtxtbxpwd.Value
End If
Next
Else
End If
End Sub
Bookmarks