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.

Validar que todos los TextBox de un formulario estén informados

publicado

Hola:

Os dejo esta macro que comprueba que todos los TextBox de un formulario contienen información.

Los errores son remarcados con fondo amarillo.

Si hay errores, el cursor se posiciona en el primer TextBox erróneo.


Private Sub ValidarTextBox()
Dim Errores As Integer, Campo As Control, Control As Control

For Each Control In Controls
If TypeOf Control Is MsForms.TextBox Then
Control.BackColor = vbWhite
If Control.Value = Empty Then
If Campo Is Nothing Then
Set Campo = Control
End If
Control.BackColor = vbYellow
Errores = Errores + 1
End If
End If
Next

If Errores > 0 Then
Campo.SetFocus
MsgBox "Debe rellenar todos los campos", , "Depuración de datos"
Exit Sub
End If

End Sub


[/CODE]

Saludos a todos

Featured Replies

  • 2 years later...
publicado

excelente asi ya no tendre q enumerarlos es perfecto, gracais por ese aporte

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.