No dejar celdas vacías al momento de ingresarlos a los campos

Tengo un problema ya que todo me funciona bien pero al momento de ingresar o no, los datos en textbox19, textbox20, textbox21 siempre me deja el espacio y no quiero que deje espacios en blanco si no los ingreso, me pueden ayudar

Sheets("Hoja1").Select 'Selecciona la Hoja1
ActiveSheet. Unprotect 'Desprotege la hoja activa. Sin contraseña

Sheets("hoja1"). Activate
If TextBox2 = "" Or TextBox3 = "" Or TextBox5 = "" Or _
TextBox15 = "" Or TextBox19 = "" Then
MsgBox "Está dejando campos requeridos vacios favor complete", vbExclamation, "Almacen"
TextBox3.SetFocus
Exit Sub
End If
Range("A" & Rows.Count).End(xlUp).Offset(3).Select
ActiveCell = TextBox2.Value
ActiveCell.Offset(0, 1) = TextBox3.Value
ActiveCell.Offset(0, 2) = TextBox5.Value
ActiveCell.Offset(0, 3) = TextBox19.Value
ActiveCell.Offset(1, 3) = TextBox20.Value
ActiveCell.Offset(2, 3) = TextBox21.Value
ActiveCell.Offset(0, 4) = ComboBox1.Value
ActiveCell.Offset(0, 5) = ComboBox2.Value
ActiveCell.Offset(0, 6) = TextBox7.Value
ActiveCell.Offset(0, 7) = TextBox15.Value
Set h1 = Sheets("IMPRIMIR")

h1.Range("F14") = Me.TextBox2.Text
h1.Range("1 Rectángulo") = Me.TextBox3.Text
h1.Range("C20") = Me.TextBox5.Text
h1.Range("C23") = Me.TextBox15.Text
h1.Range("C26") = Me.ComboBox1.Text
h1.Range("C27") = Me.ComboBox2.Text
h1.Range("C32") = Me.TextBox19.Text

MsgBox "Registro ingresado exitosamente", vbInformation, "Servitap"
PrepararNuevo

Respuesta
2

Reemplaza estas líneas

ActiveCell.Offset(0, 3) = TextBox19.Value
ActiveCell.Offset(1, 3) = TextBox20.Value
ActiveCell.Offset(2, 3) = TextBox21.Value

Por estas

If TextBox19.Value <> "" Then ActiveCell.Offset(0, 3) = TextBox19.Value
If TextBox20.Value <> "" Then ActiveCell.Offset(1, 3) = TextBox20.Value
If TextBox21.Value <> "" Then ActiveCell.Offset(2, 3) = TextBox21.Value


.

'S aludos. Dante Amor. Recuerda valorar la respuesta. G racias

.

Avísame cualquier duda

.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas