No encuentro que falla en el código al registrar
Intento registrar y me da un error 13 y no sé por que. Seguramente será una tontería, pero se me escapa.
Private Sub CommandButton1_Click()
Dim h1 As Worksheets, f As Long
If TextBox1 = "" Then Exit Sub
Set buscar = Sheets("Hoja1").Range("A:A").Find(TextBox1, LookIn:=xlValues, lookat:=xlWhole)
If Not buscar Is Nothing Then
MsgBox "Este código ya existe."
TextBox1 = "": TextBox1.SetFocus
Cancel = True
Else
Set h1 = Sheets("Hoja1") '<-Error 13 (No coinciden los tipos)
f = h1.Range("A" & Rows.Count).End(3).Row + 1
h1.Cells(f, "A").Value = TextBox1.Value
h1.Cells(f, "B").Value = TextBox2.Value
h1.Cells(f, "C").Value = TextBox3.Value
MsgBox "Registro realizado con éxito"
End If
End Sub
1 Respuesta
Respuesta de Dante Amor
1