Hello,
The code below works perfectly to copy the last row of data from multiple files under one folder to a single sheet in a new file, but my source files have several tabs.
I am unsure where to specify the name of the sheet that I want to copy from. In my particular case, it will always be the same name, FYVariance, for example.
Thank you in advance for suggestions to solve this.
The code below works perfectly to copy the last row of data from multiple files under one folder to a single sheet in a new file, but my source files have several tabs.
I am unsure where to specify the name of the sheet that I want to copy from. In my particular case, it will always be the same name, FYVariance, for example.
Thank you in advance for suggestions to solve this.
Code:
Sub merched()
Dim SrcBook As Workbook
Dim fso As Object, f As Object, ff As Object, f1 As Object
Application.ScreenUpdating = False
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.Getfolder("D:\Temp\")
Set ff = f.Files
For Each f1 In ff
Set SrcBook = Workbooks.Open(f1)
Range("E8:IV" & Range("E65536").End(xlUp).Row).Copy
ThisWorkbook.Worksheets(1).Activate
Range("E65536").End(xlUp).Offset(1, 0).PasteSpecial
Application.CutCopyMode = False
SrcBook.Close
Next
End Sub