Como condicionar una operación de una macro
Tengo varios textbox el cual ya coloque condición de que si no estaba lleno arrojara un mensaje y lo colocara en el mismo textbox así a varios textbox, entonces cuando ninguno esta aparecen todos los mensajes; adicional a esto coloque que fuera a una hoja y me agregara una fila; la pregunta es: que código tengo que usar para que si en el caso que no llenaran un textbox no hiciera la operación de agregar filas en la otra hoja
Este es el código que tengo
Private Sub CommandButton1_Click()
Dim ren As Long
If tipo_operacion.Text = "" Then
MsgBox ("INGRESA TIPO DE OPERACION")
tipo_operacion.SetFocus
End If
If orden_p.Text = "" Then
MsgBox ("INGRESA LA ORDEN DE PRODUCCION")
orden_p.SetFocus
End If
If origen.Text = "" Then
MsgBox ("INGRESA TIPO DE ORIGEN")
origen.SetFocus
End If
If maq.Text = "" Then
MsgBox ("INGRESA LA MAQUINA")
maq.SetFocus
End If
If cod_ref.Text = "" Then
MsgBox ("INGRESA EL CODIGO DE LA REFERENCIA")
cod_ref.SetFocus
End If
If prod_ref.Text = "" Then
MsgBox ("INGRESA EL PRODUCTO DE REFERENCIA")
prod_ref.SetFocus
End If
If c_total.Text = "" Then
MsgBox ("INGRESA LA CANTIDAD PRODUCIDA")
c_total.SetFocus
End If
If s_total.Text = "" Then
MsgBox ("INGRESA EL SCRAP")
s_total.SetFocus
End If
Application.ScreenUpdating = False
Sheets("BD INGRESO PRODUCCION").Select
Range("A3:X3").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromRightOrBelow
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("C3").Select