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.

File Dialog para copiar y pegar info de un libro a otro.

publicado

Buenas tardes, hice este código en VBA, consiste en abrir un dialogo para seleccionar un archivo, después copiar la info de la tabla que va de "C6" a "K" la fila K varía a veces más o menos filas ocupadas... después pegar la info en una tabla de otro libro, de igual manera empezando en "C6" o en la última fila que se encuentre texto o información.

El problema es que copia y pega todo el rango que puse, "C6:K125" inclusive las filas vacías y después al querer pegar en la ultima fila, aparece el error '1004 en la línea resaltada del código, creo que este ultimo está mal hecho.

 

Alguien sabe como arreglarlo?

_____________________________________________________________________________________________________________

Sub Prueba_Ytb_2()
    Dim FileToOpen As Variant
    Dim OpenBook As Workbook
   Application.ScreenUpdating = False
   FileToOpen = Application.GetOpenFilename(Title:="Seleccionar archivo", FileFilter:="Excel Files(*.xls*),*xls*")
   If FileToOpen <> False Then
    Set OpenBook = Application.Workbooks.Open(FileToOpen)
    OpenBook.Sheets(7).Range("C6:K125").Copy
    ThisWorkbook.Worksheets("Hoja1").Range("C6" & Rows.Count).End(xlUp).Row.PasteSpecial xlPasteValues
    OpenBook.Close True
    
   End If
   Application.ScreenUpdating = True
End Sub

___________________________________________________________________________________________________________________________

Muchas gracias.

Featured Replies

publicado

Prueba a ver si es esto lo que buscas:

Sub Prueba_Ytb_2()
   Dim FileToOpen As Variant
   Dim OpenBook As Workbook
   Application.ScreenUpdating = False
   FileToOpen = Application.GetOpenFilename(Title:="Seleccionar archivo", FileFilter:="Excel Files(*.xls*),*xls*")
   If FileToOpen <> False Then
      Set OpenBook = Application.Workbooks.Open(FileToOpen)
      OpenBook.Sheets(7).Range("C6:K" & OpenBook.Sheets(7).Range("C" & Rows.count).End(xlUp).Row).Copy
      ThisWorkbook.Worksheets("Hoja1").Range("C" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
      OpenBook.Close    
   End If
   Application.ScreenUpdating = True
End Sub

 

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.