• Jueves 28 de Marzo de 2024, 16:54

Autor Tema:  buscar y borrar datos ingresados a través de un formulario hecho en visual basic  (Leído 2546 veces)

bala

  • Nuevo Miembro
  • *
  • Mensajes: 1
    • Ver Perfil
Hola amigos:
Tengo dos problemas, el primero es que al ingresar datos a través de una formulario que creé a excel, estos se guardan super bien, pero al intentar buscar uno de esos datos ingresados, sólo me muestra las 2 primeras columnas de la fila que quiero que me muestre completa. (adjunto mi código a continuación).

Private Sub CommandButton2_Click()

Cells.Find(What:=TextBox1, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Activate

ActiveCell.Offset(0, 1).Select
TextBox2 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox3 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox4 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox6 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox10 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox11 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox12 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox13 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox14 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox15 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox16 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox17 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox18 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox19 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox20 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox21 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox23 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox24 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox25 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox26 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox27 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox28 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox29 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox30 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox31 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox32 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox33 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox34 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox35 = ActiveCell


End Sub

Por otra parte, al eliminar una fila de datos, no me elimina la que quiero eliminar, sino que la primera que encuentra, eliminando cualquier cosa menos lo que debe. (adjunto mi código a continuación).

Private Sub CommandButton3_Click()
Selection.EntireRow.Delete

Range("A6").Select

TextBox1 = Empty
TextBox2 = Empty
TextBox3 = Empty
TextBox4 = Empty
TextBox6 = Empty
TextBox10 = Empty
TextBox11 = Empty
TextBox12 = Empty
TextBox13 = Empty
TextBox14 = Empty
TextBox15 = Empty
TextBox16 = Empty
TextBox17 = Empty
TextBox18 = Empty
TextBox19 = Empty
TextBox20 = Empty
TextBox21 = Empty
TextBox23 = Empty
TextBox24 = Empty
TextBox25 = Empty
TextBox26 = Empty
TextBox27 = Empty
TextBox28 = Empty
TextBox29 = Empty
TextBox30 = Empty
TextBox31 = Empty
TextBox32 = Empty
TextBox33 = Empty
TextBox34 = Empty
TextBox35 = Empty

TextBox1.SetFocus
End Sub

Agradeceré cualquier ayuda