Please, I need a little help.
I want to copy a range from many excel files and paste into another one.
All the files (with the ranges to be copied) are closed inside a folder, with sequential names .
The file that will receive the ranges ("Boxx") is in another folder.
I want to copy the range "B1:S5" and paste in "B1"(in "Boxx").
Then, the next ranges should be pasted sequentially in B6, B11, B16, etc.
The closest VBA code I've found and modified is here:
Sub Themissedline()
Dim lCount As Long
Dim wbResults As Workbook
Dim wbCodeBook As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
On Error Resume Next
Set wbCodeBook = ThisWorkbook
With Application.FileSearch
.NewSearch
'Change path to suit
.LookIn = "E:\DOWNLOADS\IIII"
.FileType = msoFileTypeExcelWorkbooks
'Optional filter with wildcard
'.Filename = "*AAAA.xls"
If .Execute > 0 Then 'Workbooks in folder
For lCount = 1 To .FoundFiles.Count 'Loop through all
'Open Workbook x and Set a Workbook variable to it
Set wbResults = Workbooks.Open(Filename:=.FoundFiles(lCount), UpdateLinks:=0)
wbResults.Worksheets("Plan1").Range("B1:S5").Copy
wbCodeBook.Worksheets("Plan1").Range("B1" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
wbResults.Close SaveChanges:=False
Next lCount
End If
End With
On Error GoTo 0
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub
What's the missed line??
Bookmarks