Pregunta para Luis Mondelo!

Luis. Buen dia!! Luis tengo esta macro:

Private Sub CommandButton7_Click()

Sheets("EGRESOS ALMACEN").Select

Range("a3").Select

Do While Not IsEmpty(ActiveCell)

ActiveCell.Offset(1, 0).Select

Loop

ActiveCell = TextBox3

ActiveCell.Offset(0, 1).Select

ActiveCell = TextBox5

ActiveCell.Offset(0, 1).Select

ActiveCell = TextBox6

ActiveCell.Offset(0, 1).Select

ActiveCell = TextBox22

ActiveCell.Offset(0, 1).Select

ActiveCell = TextBox4

ActiveCell.Offset(0, 1).Select

End Sub

BIEN: Luis, en el textBox22 se escribe texto, y en el textbox4 números. Como hago para esta macro funcione, siempre y cuando los textBox22 y textbox4 contengan datos. Osea, que haga un MSGBOX que avise que faltan completar datos!!.

GRACIAS LUIS!!!

1 Respuesta

Respuesta
1

Incluye las siguientes líneas al principio de esa macro:

if isempty(textbox22) ="" or isempty(textbox4) then

msgbox "Debe completar los datos......."

exit sub

end if

Hola Luis!! Luis ahi pegue la macro al principio, como vos me dijiste, y me sale un error que dice que ERROR 13 EN TIEMPO DE ......NO COINCIDEN LOS TIPO!!!

Daniel hay un error de escritura las líneas que tienes que incluir son estas:

(Las pones al principio de la macro)

Private Sub CommandButton7_Click()

if isempty(textbox22) or isempty(textbox4) then
msgbox "Debe completar los datos......."
exit sub
end if

...
...

...

Luis: ahora no me funciona. Lo que si, no me tira ningún error, osea la macro funciona bien!! pero no me avisa que están vacíos los textBox!!. Ahora te mando un mail de la macro como quedo con tu ultima modificación!!!.

Prueba a ponerlo así:

Private Sub CommandButton7_Click()
if textbox22.value ="" or textbox4.value ="" then
msgbox "Debe completar los datos......."
exit sub
end if
...
...
...

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas