Error compilacion. no se ha definido sub o funtion

Cerrado
Queen - 3 mar 2018 a las 15:32
 Queen - 3 mar 2018 a las 15:34
Tengo un problema con una macro. Estoy intentando hacer una formulario login para que introduzcan contraseñas varios usuarios para acceder al excel. Pero me da el error siguiente:
ERROR DE COMPILACION: NO SE HA DEFINIDO SUB O FUNTION. Esta es la macro que tengo en el boton entrar del login.

Alguine detecta el error. ya le he dado mil vueltas.

Private Sub cmdEntrar_Click()
Dim huser As Worksheet
Dim Ufila As Integer
Dim switch As Boolean

Set huser =Worksheet("Calendario")
Ufila = huser.Range("A" & Rows.Count).End(x1Up).Row

For i = 100 To Ufila
If huser.Range("A" & i).Value = txtUser.Text And huser.Range("B" & i).Value = txtPass.Text Then
switch = True
Exit For
Else
switch = False
End If
Next i

If switch = True Then
MsgBox "Datos correctos, Bienvenido al Control de Vacaciones", vbInformation, "Ok"
Application.Visible = True
Else
MsgBox "Datos incorrectos, intentelo de nuevo", vbExclamation, "Error"
End If

End Sub
Consulta también:

1 respuesta

El error se me muestra en: (fila1)

Private Sub cmdEntrar_Click()

y en:(fila5)

Set huser =Worksheet("Calendario")
0