Sheet Protection, password test
VBA Protection, password test
transformation to sheet1 by Userform
Private Sub ComboBox1_Click()
With Sheets("Users")
mr = Application.Match(ComboBox1, .Range("A:A"), 0)
TextBox1 = .Cells(mr, 2)
TextBox2 = .Cells(mr, 3)
End With
End Sub
Private Sub CommandButton1_Click()
Dim mkey As String
mkey = ComboBox1 & TextBox1 & TextBox2 & ComboBox2
With Sheets("Sheet1")
lr = .Range("A" & Rows.Count).End(xlUp).Row
arr = .Range("A2", "E" & lr)
For x = 1 To UBound(arr)
arr(x, 5) = arr(x, 1) & arr(x, 2) & arr(x, 3) & arr(x, 4)
If arr(x, 5) = mkey Then j = j + 1
Next
If j < 3 Then
.Unprotect "test"
.Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(, 6) = Array(ComboBox1, TextBox1, TextBox2, ComboBox2, TextBox4 & "%", j + 1)
.Protect "test"
Else
MsgBox "Limit Off 3 Attemptions Are Done" & Chr(13) & "So This Try Is Not Allowed"
End If
End With
Unload Me
End Sub
Private Sub UserForm_Initialize()
With Sheets("Users")
lr = .Range("A" & Rows.Count).End(xlUp).Row
arr = .Range("A2", "A" & lr)
ComboBox1.List = arr
End With
With Sheets("Technology")
lr = .Range("A" & Rows.Count).End(xlUp).Row
arr = .Range("A2", "A" & lr)
ComboBox2.List = arr
End With
End Sub
Kind regards
Leo
Bookmarks