Consulta formulario
Hola tengo un formulario excel con la siguiente configuración en el botón ingresar o CommandButton ingresar,... Lo que sucede es que al ingresar lineas de datos, lo hace desde la linea 2 hacia abajo y ahora necesito que los ingrese desde la linea 4 hacia abajo y no se cual es la arte que hay que modificar o agregar o quitar. Bueno solo eso aquí esta la configuración..
Muchas gracias
Saludos
Bendiciones
Private Sub CommandButton1_Click()
Dim strfila$
'activamos la hoja 1 donde se encuentran los datos
Worksheets("hoja1").Activate
'desprotegemos la hoja1 para que se ingresen los nuevos datos
Worksheets("hoja1").Unprotect
' Selection.End(xlUp).Select
Dim fila As String
'verificamos que todos los campos esten llenos
If TextBox1 = Empty Or TextBox2 = Empty Or TextBox3 = Empty Or TextBox4 = Empty Or TextBox5 = Empty Or ComboBox1 = Empty Then
MsgBox prompt:="No deje ningun campo vacio", Buttons:=vbOKOnly, Title:="Campo vacio"
GoTo seguir
End If
'verificamos que el campo de edad sea numerico
If Not IsNumeric(TextBox4) Then
MsgBox prompt:="Ingrese una edad numerica", Buttons:=vbOKOnly, Title:="Edad"
TextBox4 = Empty
GoTo seguir
End If
'verificamos que se ingrese una edad razonable
If TextBox4.Value <= 0 Or TextBox4.Value >= 120 Then
MsgBox prompt:="Ingrese una edad adecuada", Buttons:=vbOKOnly, Title:="Edad"
TextBox4 = Empty
GoTo seguir
End If
[A65536].End(xlUp).Offset(1, 0).Select
strfila$ = ActiveCell.Row
ActiveCell = Val(TextBox5)
Range("b" + strfila$) = TextBox1
Range("c" + strfila$) = TextBox2
Range("d" + strfila$) = TextBox3
Range("e" + strfila$) = ComboBox1
Range("f" + strfila$) = Val(Round(TextBox4, 0))
Worksheets("hoja1").Protect
Range("a1").End(xlDown).Select
TextBox5 = ActiveCell.Value + 1
TextBox1 = "": TextBox2 = "": TextBox3 = "": TextBox4 = "": ComboBox1 = ""
Exit Sub
Seguir:
TextBox1.SetFocus
End Sub
Muchas gracias
Saludos
Bendiciones
Private Sub CommandButton1_Click()
Dim strfila$
'activamos la hoja 1 donde se encuentran los datos
Worksheets("hoja1").Activate
'desprotegemos la hoja1 para que se ingresen los nuevos datos
Worksheets("hoja1").Unprotect
' Selection.End(xlUp).Select
Dim fila As String
'verificamos que todos los campos esten llenos
If TextBox1 = Empty Or TextBox2 = Empty Or TextBox3 = Empty Or TextBox4 = Empty Or TextBox5 = Empty Or ComboBox1 = Empty Then
MsgBox prompt:="No deje ningun campo vacio", Buttons:=vbOKOnly, Title:="Campo vacio"
GoTo seguir
End If
'verificamos que el campo de edad sea numerico
If Not IsNumeric(TextBox4) Then
MsgBox prompt:="Ingrese una edad numerica", Buttons:=vbOKOnly, Title:="Edad"
TextBox4 = Empty
GoTo seguir
End If
'verificamos que se ingrese una edad razonable
If TextBox4.Value <= 0 Or TextBox4.Value >= 120 Then
MsgBox prompt:="Ingrese una edad adecuada", Buttons:=vbOKOnly, Title:="Edad"
TextBox4 = Empty
GoTo seguir
End If
[A65536].End(xlUp).Offset(1, 0).Select
strfila$ = ActiveCell.Row
ActiveCell = Val(TextBox5)
Range("b" + strfila$) = TextBox1
Range("c" + strfila$) = TextBox2
Range("d" + strfila$) = TextBox3
Range("e" + strfila$) = ComboBox1
Range("f" + strfila$) = Val(Round(TextBox4, 0))
Worksheets("hoja1").Protect
Range("a1").End(xlDown).Select
TextBox5 = ActiveCell.Value + 1
TextBox1 = "": TextBox2 = "": TextBox3 = "": TextBox4 = "": ComboBox1 = ""
Exit Sub
Seguir:
TextBox1.SetFocus
End Sub
1 respuesta
Respuesta de Elsa Matilde
1