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.

Macro juntar varios archivos y crear un nuevo archivo

publicado

Que tal a todos.

Soy nuevo en este foro. Solicito de su apoyo y amable cooperación para realizar un macro el cual su funcion sea la siguiente:

Tengo una carpeta con mas de 1000 archivos .xls los cuales quiero unir es un nuevo archivo de excel; los archivos tienen las mismas columnas, el problema es que el rango en cada archivo es variable.

En el archivo Juntar.xls tengo lo que llevo de la macro, podrian ayudarme a solucionar este problema.


Option Explicit

Sub LlenaCuadros()
Dim wb As Workbook
Dim strArchivoExcel As String
Dim strNombreCarpeta As String

strNombreCarpeta = PonDiag(ActiveWorkbook.Path)

'preparar carpeta
ChDir strNombreCarpeta
strArchivoExcel = Dir("*.xls")

'repasamos los archivos de la carpeta
Do While strArchivoExcel <> ""
Set wb = Workbooks.Open(strNombreCarpeta & "\" & strArchivoExcel)
MsgBox wb.ActiveSheet.Cells(1, 1)
wb.Close False
Set wb = Nothing
strArchivoExcel = Dir
Loop

End Sub

Function PonDiag(Path As String) As String
'Devuelve Path agregándole la diagonal final si lo necesita.
PonDiag = IIf(Right(Path, 1) = "\", Path, Path & "\")
End Function
[/code]

De antemano gracias.

Saludos.

macro.rar

Juntar.xls

macro.rar

Juntar.xls

Featured Replies

No hay posts para mostrar

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.