Me da error 13 en tiempo de ejecución. No coinciden los tipos
Publicado por Carlos (1 intervención) el 07/11/2019 23:09:38
Estoy haciendo un formulario para ingresar datos a una tabla de datos en excel y me tira el error 13, me podrían ayudar con este error?. Gracias
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Private Sub imgCerrar_Click()
Unload Me
End Sub
Private Sub imgGuardar_Click()
GuardarInformacion
End Sub
Sub GuardarInformacion()
Rem Declaración de variables
Dim contFila As Long
Dim hoja As Worksheets
Set hoja = Worksheets(1) <= (Aquí me da el error)
' Validamos que los campos de texto correspondientes a los datos de empleados esten completos
If Trim$(txtMatricula.Text) = Empty Or Trim$(txtNombre.Text) = Empty Or Trim$(txtApellido.Text) = Empty Or Trim$(txtPuesto.Text) = Empty Or Trim$(txtSueldo.Text) = Empty Then
MsgBox "Por favor ingrese todos los datos!", vbCritical, "Datos incompletos"
Exit Sub
End If
' Validamos la fila siguiente en la hoja donde se deben ingresar los datos
contFila = hoja.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
hoja.Cells(contFila, 1).Value = Me.txtMatricula.Value
hoja.Cells(contFila, 2).Value = Me.txtNombre.Value
hoja.Cells(contFila, 3).Value = Me.txtApellido.Value
hoja.Cells(contFila, 4).Value = Me.txtPuesto.Value
hoja.Cells(contFila, 5).Value = Me.txtSueldo.Value
' Se limpia o borra los datos de los campos de texto del formulario
Me.txtMatricula.Value = ""
Me.txtNombre.Value = ""
Me.txtApellido.Value = ""
Me.txtPuesto.Value = ""
Me.txtSueldo.Value = ""
End Sub
Valora esta pregunta
0