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.

Como hacer sentencia que pare mi macro cuando encuentre celda vacia

publicado

Buenos dias tengo la sigueinte macro que me pone ingreso y no ingreso en la celda G de mi archivo lo que necesito es que solo se ejecute cuando enecuentre campos en la celda si no encuentra datos pare.

Sub VALIDA_CAMPO_ULTIMO_ACCESO()

Dim UltiFila, i As Integer

UltiFila = WorksheetFunction.CountA(Range("A12:H30000"))

For i = 12 To UltiFila

If Cells(i, "G") <> "Nunca" Then

Cells(i, "G") = "Ingreso"

Else

Cells(i, "G") = "No ingreso"

End If

If Cells(i, "H") = "-" Then

Cells(i, "G") = "No Ingreso"

End If

Next

End Sub

Gracias por su ayuda

Featured Replies

publicado

Sustituye:

UltiFila = WorksheetFunction.CountA(Range("A12:H30000"))[/CODE]

Por:

[CODE]UltiFila = Range("A" & Rows.Count).End(xlUp).Row[/CODE]

publicado
  • Autor

Hola me funciona bien te tengo una ultima pregunta cuando ejecuto esta macro sobre 40000 registro me sale error en esta parte del codigo For i = 2 To UltiFila me podrias ayudar gracias

publicado

_

Dim UltiFila As Long, i As Long en lugar de Dim UltiFila, i As Integer

El tipo Integer solo admite valores hasta mas o menos 32.000.

Mira en la Ayuda de VBA "Definición de variables".

Añade como primera instrucción: Application.ScreenUpdating = False y te irá mucho mas rápido.

_

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.