Attribute VB_Name = "LoopFilesInFolder" ' Recorre cada .xlsx de una carpeta e imprime el nombre + nĂºmero de filas. Sub LoopFilesInFolder() Dim folderPath As String, file As String Dim wb As Workbook, n As Long With Application.FileDialog(msoFileDialogFolderPicker) If .Show <> -1 Then Exit Sub folderPath = .SelectedItems(1) & "\" End With file = Dir(folderPath & "*.xlsx") Do While file <> "" Set wb = Workbooks.Open(folderPath & file, ReadOnly:=True) Debug.Print file, wb.Sheets(1).UsedRange.Rows.Count wb.Close SaveChanges:=False n = n + 1 file = Dir Loop MsgBox "Se procesaron " & n & " archivos. Mira la ventana Inmediato (Ctrl+G).", vbInformation End Sub