Textbox sin información colocar un guión

Buenas días, por favor me puede decir, como hago para colocar un guión a un textbox que no haya se le haya introducido información, me explico: Resulta que tengo un userform donde voy a capturar 7 textbox´s, cuya información son observaciones que se hacen (esto corresponde a los 7 días de la semana), puede ser que hayan observaciones, como no, pero si no hay debo colocar un guión o un asterisco, no puede quedar en blanco esa celda cuyo textbox no obtuvo información. Te muestro como tengo mi macro: Hasta aquí funciona bien.
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim fila As Integer
fila = 9
While Cells(fila, 23) <> Empty
fila = fila + 1
Wend
Cells(fila, 23) = TextBox1
Cells(fila + 1, 23) = TextBox2
Cells(fila + 2, 23) = TextBox3
Cells(fila + 3, 23) = TextBox4
Cells(fila + 4, 23) = TextBox5
Cells(fila + 5, 23) = TextBox6
Cells(fila + 6, 23) = TextBox7
End
If TextBox1.Text = " " Then Cells(fila, 23) = "-" Else Cells(fila, 23) = TextBox1
If TextBox2.Text = " " Then Cells(fila + 1, 23) = "-" Else Cells(fila, 23) = TextBox2
If TextBox3.Text = " " Then Cells(fila + 2, 23) = "-" Else Cells(fila, 23) = TextBox3
If TextBox4.Text = " " Then Cells(fila + 3, 23) = "-" Else Cells(fila, 23) = TextBox4
If TextBox5.Text = " " Then Cells(fila + 4, 23) = "-" Else Cells(fila, 23) = TextBox5
If TextBox6.Text = " " Then Cells(fila + 5, 23) = "-" Else Cells(fila, 23) = TextBox6
If TextBox7.Text = " " Then Cells(fila + 6, 23) = "-" Else Cells(fila, 23) = TextBox7
TextBox1 = Empty
TextBox2 = Empty
TextBox3 = Empty
TextBox4 = Empty
TextBox5 = Empty
TextBox6 = Empty
TextBox7 = Empty
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

1 Respuesta

Respuesta
1
Ya te cinteste anteriormente..
Mira en la selecciona el textbox1, presionas el botón derecho del mouse, seleccioinas ver código, y dentro del evento "Exit" "Salir" pones
If TextBox1.Value = "" Then
TextBox1.Value ="*"
End If
Saludos
Visita mi sitio

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas