Estoy utilizando el cuadro de usuario pero intento cambiar el nombre de los usuarios me genera el error de clave o usuario incorrecta
algo asi como esto
Private Sub CommandButton3_Click()
On Error GoTo xxx
Dim Clave As String
Clave = Application.WorksheetFunction.VLookup(TextBox1, Worksheets("hoja5").Range("A2:B4"), 3)
If TextBox2 <> Clave Then
MsgBox "Usuario y/o clave incorrecta", vbOKOnly, "ERROR"
TextBox1 = ""
TextBox2 = ""
Exit Sub
End If
Application.Visible = True
If TextBox1 = "a" Then
ActiveWorkbook.Unprotect
Worksheets("comprobante").Unprotect
Worksheets("comprobante2").Unprotect
Worksheets("comprobante").Visible = True
Worksheets("comprobante2").Visible = True
Unload UserForm1
Exit Sub
End If
ActiveWorkbook.Unprotect
Worksheets("comprobante").Unprotect
Worksheets("comprobante2").Unprotect
Worksheets("comprobante").Visible = True
Worksheets("comprobante2").Visible = True
Worksheets("comprobante").Protect
Worksheets("comprobante2").Protect
ActiveWorkbook.Protect
Unload UserForm1
Exit Sub
xxx:
MsgBox "Usuario y/o clave incorrecta", vbOKOnly, "ERROR"
TextBox1 = ""
TextBox2 = ""
End Sub
Private Sub CommandButton4_Click()
On Error Resume Next
Worksheets("comprobante").Visible = xlVeryHidden
Worksheets("comprobante2").Visible = xlVeryHidden
Worksheets("comprobante").Protect
Worksheets("comprobante2").Protect
ActiveWorkbook.Protect
Unload UserForm1
ThisWorkbook.Save
ActiveWorkbook.Close
End Sub
Private Sub Label1_Click()
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Por favor, para salir usa el boton correspondiente", vbInformation, "SALIR"
End If
End Sub
que estoy haciendo mal?