Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Detener macro si no es igual a cero

publicado

Buenas tardes.

recurro de nuevo a ustedes para ver si me pueden apoyar.

Tengo esta macro que guarda toda la informacion de un userform, pero quiero que se detenga si el

Textbox3 no es igual a cero, el textbox3 debe ser iagual a Cero para continuar el procedimiento.

Private Sub CommandButton3_Click()

'Seleccionar hoja
Sheets("Corte").Select
'selecionar rango de celdas a insertar
Range("A10:S10").Select
'Inserta Celdas SEleccionadas
Selection.Insert Shift:=xlDown
'Copia y pega los rangos seleccionados
Range("A9:S9").Select
Selection.Copy
Range("A10").Select
ActiveSheet.Paste
'Finaliza apliaccion
Application.CutCopyMode = False

Range("C10").Select
'grabamos los datos en la primera fila vacía
'Fecha
ActiveCell = TextBox1
'Caja Chica
ActiveCell.Offset(0, 1) = CDbl(TextBox2)
'Total Efectivo
ActiveCell.Offset(0, 2) = CDbl(TextBox17)
'Diferencia
ActiveCell.Offset(0, 3) = CDbl(TextBox3)
'50 Centavos
ActiveCell.Offset(0, 4) = CDbl(TextBox4)
'1 Peso
ActiveCell.Offset(0, 5) = CDbl(TextBox5)
'2 Pesos
ActiveCell.Offset(0, 6) = CDbl(TextBox6)
'5 Pesos
ActiveCell.Offset(0, 7) = CDbl(TextBox7)
'10 Pesos
ActiveCell.Offset(0, 8) = CDbl(TextBox8)
'20 Pesos
ActiveCell.Offset(0, 9) = CDbl(TextBox9)
'50 Pesos
ActiveCell.Offset(0, 10) = CDbl(TextBox10)
'100 Pesos
ActiveCell.Offset(0, 11) = CDbl(TextBox11)
'200 Pesos
ActiveCell.Offset(0, 12) = CDbl(TextBox12)
'500 Pesos
ActiveCell.Offset(0, 13) = CDbl(TextBox13)
'1000 Pesos
ActiveCell.Offset(0, 14) = CDbl(TextBox14)
'ponemos el focus en el TextBox2
TextBox2.SetFocus
'limpiamos los textbox
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
TextBox9 = ""
TextBox10 = ""
TextBox11 = ""
TextBox12 = ""
TextBox13 = ""
TextBox14 = ""
End Sub[/PHP]

Muchas gracias por su ayuda.

Featured Replies

publicado

¿Lo que necesitas es que llegue hasta un punto determinado o solo se inicie el procedimiento si ese Textbox3 es igual a 0?

Un saludo,

Tese

publicado

Lo arreglas así

Private Sub CommandButton3_Click()
Do While Val(textbox3.Text) = 0
.................. Todo tu código
Loop
End Sub[/CODE]

publicado

Hola:

Puedes poner este codigo al inicio

if val(textbox3.text)=0 then
exit sub
end if[/CODE]

Saludos

publicado
  • Autor

Gracias por tomarse la molestia de responder mi duda. Gracias.

Gracias a ti "elunico22" me resolviste mi duda.

Tema Solucionado

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.