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.

Copiar y Pegar (Mejorar Macro)

publicado

Hola a tod@s. 

Como siempre agradecido por su tiempo y aporte para este nuevo tema.

Tengo la siguiente macro

Sub CopyPaste()
    Dim xRng As Range
    On Error Resume Next
        Set xRng = Application.InputBox("Selecciones el rango:", "MS Excel", , , , , , 8).Select
   '     If xRng Is Nothing Then Exit Sub
        Selection.SpecialCells(xlCellTypeBlanks).Select
        Range("A1").End(xlDown).Offset(1, 0) = "=R[-1]C"
        Columns("A:A").SpecialCells(xlCellTypeFormulas, 23).Copy
'        Range("A1").End(xlDown).Copy
        ActiveSheet.Paste

End Sub

El cual funciona bien cuando se ingresa el rango en el InputBox. El detalle esta cuando decido "Cancelar" el InputBox; la macro continua ejecutandose ?.

Cuando activo activo el "bloque sin comentarios" de la siguiente linea

If xRng Is Nothing Then Exit Sub

la macro no se ejecuta ?

Saludos

 

 

PruebaCopyPaste.xlsm

Featured Replies

publicado

Hola, el código debería ir así:

Sub CopyPaste()
    Dim xRng As Range
    On Error Resume Next
        Set xRng = Application.InputBox("Selecciones el rango:", "MS Excel", , , , , , 8)
        If xRng Is Nothing Then Exit Sub
        xRng.SpecialCells(xlCellTypeBlanks).Select
        Range("A1").End(xlDown).Offset(1, 0) = "=R[-1]C"
        Columns("A:A").SpecialCells(xlCellTypeFormulas, 23).Copy
'        Range("A1").End(xlDown).Copy
        ActiveSheet.Paste

End Sub

Saludos

publicado
  • Autor
Hace 3 horas, AlexanderS dijo:

Hola, el código debería ir así:

Saludos

Hola @AlexanderS , muchas gracias por su tiempo y aporte; esta perfecto.

Doy por terminado el tema.

Saludos

Editado el por CarlosKurt

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.