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.

Leer varios archivos de excel y concentrar en una sola hoja

publicado

Hola a todos amigos, tengo este código que me trae la información de un libro, sin embargo, ando intentando importar varios archivos a la vez pero ya me bloquié, este es el código que ocupo para leer el libro, espero alguien me puede dar una idea, saludos

Application.ScreenUpdating = False
Dim wbLibroOrigen As Workbook
Dim wsHojaOrigen As Worksheet

Dim wbLibroDestino As Workbook
Dim wsHojaDestino As Worksheet

Dim ruta As String

ruta = ActiveWorkbook.Path & "\" & "Lista_Negra_SAT.csv"
'Datos destino
Set wbLibroDestino = Workbooks(ThisWorkbook.Name)
Set wsHojaDestino = wbLibroDestino.Worksheets("Hoja1")

'Datos origen
Set wbLibroOrigen = Workbooks.Open(ruta)
Set wsHojaOrigen = wbLibroOrigen.Worksheets("Lista_Negra_SAT")

uFila = wsHojaOrigen.Range("A" & Rows.Count).End(xlUp).Row

wsHojaOrigen.Range("A1:AD" & uFila).Copy Destination:=wsHojaDestino.Range("DA1")
Workbooks(wbLibroOrigen.Name).Close

Application.ScreenUpdating = True

 

Featured Replies

publicado

Buenas , según tu código te paso adaptación:

Sub COPIA()


Application.ScreenUpdating = False
Dim wbLibroOrigen As Workbook
Dim wsHojaOrigen As Worksheet

Dim wbLibroDestino As Workbook
Dim wsHojaDestino As Worksheet
Dim Origen$
Dim ruta() As String

ruta = Split("Lista_Negra_SAT.csv,Lista_Negra_SAT2.csv", ",") ' lista archivos separada por ,

For x = 0 To UBound(ruta)
 Origen = ActiveWorkbook.Path & "\" & ruta(x)
 'Datos destino
 Set wbLibroDestino = Workbooks(ThisWorkbook.Name)
 Set wsHojaDestino = wbLibroDestino.Worksheets("Hoja1")

 'Datos origen
 Set wbLibroOrigen = Workbooks.Open(Origen)
 Set wsHojaOrigen = wbLibroOrigen.Worksheets(Replace(ruta(x), ".csv", ""))

 uFilaO = wsHojaOrigen.Range("A" & Rows.Count).End(xlUp).Row
 uFilaD = wsHojaDestino.Range("DA" & Rows.Count).End(xlUp).Row
 
 wsHojaOrigen.Range("A1:AD" & uFilaO).Copy Destination:=wsHojaDestino.Range("DA" & uFilaD)
 Workbooks(wbLibroOrigen.Name).Close

 Application.ScreenUpdating = True

Next

End Sub

 

Saludos

  

publicado
  • Autor

Estimado amigo @JasallBcn probé tu código y funcionó a la perfección, muchas gracias.

Doy por tema 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.