Duda al validar usuario y contraseña en excel vba
Tengo un problema la macro solo funciona bien para el administrador y para la cuenta usuario me muestra el msgbox
Private Sub CommandButton1_Click()
'
Set h1 = Sheets("USUARIOS")
'
If N_Usuario = -1 And N_Clave = "" Then Exit Sub
'
existe = False
For i = 3 To h1.Range("A" & Rows.Count).End(xlUp).Row
If N_Usuario = h1.Cells(i, "C") And N_Clave = h1.Cells(i, "D") Then
existe = True
Exit For
End If
Next
'
If existe Then
Unload Me
FrmInicio.Show
Else
MsgBox "EL USUARIO Y LA CLAVE INGRESADA SON INCORRECTOS", vbInformation + vbCritical
N_Usuario = Empty
N_Clave = Empty
N_Usuario.SetFocus
End If
End Sub
'
Private Sub UserForm_Activate()
Set hx = Sheets("USUARIOS")
'
For i = 3 To hx.Range("A" & Rows.Count).End(xlUp).Row
N_Usuario.AddItem hx.Cells(i, "C")
Next i
End Sub'

'

2 Respuestas
Respuesta de Dante Amor
1
Respuesta de Abraham Valencia
1
