problemas con textbox
Publicado por mario (1 intervención) el 26/12/2012 02:33:20
Hola a toda la comunidad el foro. tengo un problema con los textbox de un formulario. el problema es el siguiente cuando dejo algun textbox vacio y presiono el boton para ingresar los datos este me coloca el valor cero a la celda asociada al textbox.lo que yo quiero es que si yo dejo el textbox en blanco es decir sin ingresar ningun valor al momento de presionar el boton ingresar la celda asociada al textbox no tome el valor de cero (0) si no que la deje en blanco.
Gracias
adjunto el codigo
Private Sub CommandButton1_Click()
Sheets("ABONOS").Select
ufila = Cells(Rows.Count, "B").End(xlUp).Row + 1
Cells(ufila, "B") = Val(TextBox1.Value)
Cells(ufila, "C") = Val(TextBox2.Value)
Cells(ufila, "D") = Val(TextBox3.Value)
Cells(ufila, "E") = Val(TextBox4.Value)
Cells(ufila, "F") = Val(TextBox5.Value)
Cells(ufila, "G") = Val(TextBox6.Value)
TextBox1.SetFocus
TextBox1 = Empty
TextBox2 = Empty
TextBox3 = Empty
TextBox4 = Empty
TextBox5 = Empty
TextBox6 = Empty
UserForm7.Hide
End Sub
Gracias
adjunto el codigo
Private Sub CommandButton1_Click()
Sheets("ABONOS").Select
ufila = Cells(Rows.Count, "B").End(xlUp).Row + 1
Cells(ufila, "B") = Val(TextBox1.Value)
Cells(ufila, "C") = Val(TextBox2.Value)
Cells(ufila, "D") = Val(TextBox3.Value)
Cells(ufila, "E") = Val(TextBox4.Value)
Cells(ufila, "F") = Val(TextBox5.Value)
Cells(ufila, "G") = Val(TextBox6.Value)
TextBox1.SetFocus
TextBox1 = Empty
TextBox2 = Empty
TextBox3 = Empty
TextBox4 = Empty
TextBox5 = Empty
TextBox6 = Empty
UserForm7.Hide
End Sub
Valora esta pregunta


0