-
Combining data from multiple WB to Master
Hello All, and Happy 4th! to everyone.
I am using the code below to extract data from workbooks in the same folder (via download or shared drive)
It works fine as is, but I would like help with a revision that will add the data from newly added files without copying/pasting the data from the previous files once the data has been extracted.
Hope this makes sense to someone. I would appreciate any help.
Sub LoopThroughDirectory()
Dim MyFile As String
Dim erow
Dim Filepath As String
Filepath = "E:\DSS-Master"
MyFile = Dir(Filepath)
Do While Len(MyFile & Filename) > 0
If MyFile = "dssmaster.xlsm" Then
Exit Sub
End If
Workbooks.Open (Filepath & MyFile & Filename)
Range("A2:J2").Copy
ActiveWorkbook.Close
erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range(Cells(erow, 1), Cells(erow, 10))
MyFile = Dir
Loop
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules