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.

Contar textbox con un determinado valor o carácter

publicado

Hola  a todos

Tengo una inquietud, he buscado por los foros en la web, pero no he encontrado algo similar.

En el siguiente tema plantee una situación respecto de suma en tiempo real, y las respuestas fueron muy buenas.

Mi idea es si se puede hacer lo mismo pero utilizando la opción de contar varios textbox de acuerdo a un criterio.

Adjunto un libro con un formulario, si código, ya que no se por donde ir.

Las variables a contar serian "V", "F".

 

Saludos Cordiales

Pedro Venegas 

contarsi textbox.xlsm

Featured Replies

publicado
  • Autor

Hola a todos

Utilice el siguiente código y funciona.

Private Sub TextBox1_Change(): CountIf: End Sub
Private Sub TextBox2_Change(): CountIf: End Sub
Private Sub TextBox3_Change(): CountIf: End Sub

Private Sub CountIf()
If TextBox1 = "V" Or TextBox1 = "v" Then Tot = Tot + 1
If TextBox2 = "V" Or TextBox2 = "v" Then Tot = Tot + 1
If TextBox3 = "V" Or TextBox3 = "v" Then Tot = Tot + 1

TextBox4 = Val(Tot)

End Sub

Espero sea de ayuda para alguien mas, y mas importante espero este bien diseñado el código, no soy experto, voy por la vida probando y muchas veces arruinando.

Ideal si algún forero de vuestra opinión.

Saludos Cordiales

Pedro 

publicado
  • Autor

Hola de Nuevo

Agregue un nuevo textbox, para agregar una nueva funcion.

Private Sub TextBox1_Change(): SUM: CountIf: End Sub
Private Sub TextBox2_Change(): SUM: CountIf: End Sub
Private Sub TextBox3_Change(): SUM: CountIf: End Sub

Private Sub CountIf()
If TextBox1 = "V" Or TextBox1 = "v" Then Tot = Tot + 1
If TextBox2 = "V" Or TextBox2 = "v" Then Tot = Tot + 1
If TextBox3 = "V" Or TextBox3 = "v" Then Tot = Tot + 1

TextBox4 = Val(Tot)

End Sub


Private Sub SUM()
If IsNumeric(TextBox1) Then Tot = Tot + Val(TextBox1)
If IsNumeric(TextBox2) Then Tot = Tot + Val(TextBox2)
If IsNumeric(TextBox3) Then Tot = Tot + Val(TextBox3)

TextBox5 = Val(Tot)

End Sub

Funciona Perfecto, hasta el minuto.

Saludos Cordiales

Pedro Venegas

Editado el por petercien1

publicado
  • Autor

Hola a todos

Favor dar por cerrar el tema

Saludos Cordiales

Pedro

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.