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.

Error en macro

publicado

Buenas Noches

Esta macro me da error cuando la ejecuto por segunda vez en  Range("A" & ultFila).PasteSpecial xlPasteAll 

Private Sub copiarceldas3_Click()
Dim ultFila As Long, _
    wbOrigen As Workbook
    
    
    'Indicar el libro de Excel destino es la única variable que necesitas
    Set wbDestino = Workbooks.Open(ActiveWorkbook.Path & "\Factura2.xlsm")
    
    'Se saca la celda donde está la última fila que agregaste
    ultFila = Sheets("Clientes").Range("A" & Rows.Count).End(xlUp).Row
    
    'Activamos el libro origen para copiar los datos, a partir del último que copiaste en la otra hoja
    ThisWorkbook.Activate
    Sheets("Clientes").Activate
    
    'Nos vamos a la ultima celda que copiaste para solo seleccionar de ahí para abajo
    Range("A" & ultFila).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlToRight)).Select
    Selection.Copy
    
    'Regresamos al libro destino para pegar los datos
    wbDestino.Activate
    Sheets("Clientes").Activate
    'Aquí le sumamos 1 a la variable de ultFila para pegar en la primera celda vacía
    ultFila = ultFila + 1
    Range("A" & ultFila).PasteSpecial xlPasteAll
    Application.CutCopyMode = False
    
    'Guardar y cerrar el libro de Excel destino
    wbDestino.Save
    wbDestino.Close
    
End Sub

 

 

 

Alguien me podría decir el motivo gracias

Featured Replies

publicado
  • Autor

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.