
Sub copy_data()
Dim f As Object, wbk1 As Workbook, wbk2 As Workbook, rg As Long, col As Long, area As Range
Application.ScreenUpdating = False
Set wbk1 = ThisWorkbook
For Each f In CreateObject("Scripting.FileSystemObject").GetFolder(ThisWorkbook.Path & "").Files
If Left(f.Name, 1) <> "~" And (Right(f.Name, Len(f.Name) - InStrRev(f.Name, ".")) Like "*xl*") And (f.Name <> ThisWorkbook.Name) Then
Set wbk2 = Workbooks.Open(f)
rg = rg + 1
col = 0
With wbk2.Sheets("foglio1")
rw = wbk1.Sheets("foglio1").Range("A" & .Rows.Count).End(xlUp).Row
.Range("a1").CurrentRegion.Copy wbk1.Sheets("foglio1").Cells(rw, 1)
End With
wbk2.Close False
End If
Next
Application.ScreenUpdating = True
End Sub |
Sub copy_data_2()
Dim f As Object, wbk1 As Workbook, wbk2 As Workbook, rg As Long, col As Long, area As Range
Application.ScreenUpdating = False
Set wbk1 = ThisWorkbook
For Each f In CreateObject("Scripting.FileSystemObject").GetFolder(ThisWorkbook.Path & "").Files
If Left(f.Name, 1) <> "~" And (Right(f.Name, Len(f.Name) - InStrRev(f.Name, ".")) Like "*xl*") And (f.Name <> ThisWorkbook.Name) Then
Set wbk2 = Workbooks.Open(f)
With wbk2.Sheets("DETAILS")
rw = wbk1.Sheets("TRACKER").Range("A" & .Rows.Count).End(xlUp).Row
.Range("a1").CurrentRegion.Copy wbk1.Sheets("TRACKER").Cells(rw + 1, 1)
End With
wbk2.Close False
End If
Next
Application.ScreenUpdating = True
End Sub |
