Hi!
I've got a macro wich I use for consolidating everyday reports into one - it works great, but I'd like to modify it a bit.
The criteria I'd like to add:
1) I don't need all the content of each seperate file,-
The content must be evaluated by column V5,
consequently if value of column V5>0 then the row must be included in the summary;
2) One more additional column in the summary is needed, which must be filled with the name of each particular file.
The code I've been using till now:
Sub Auto_Open()
Dim objFSO As Object, objFolder As Object, objFile As Object
Dim i As Integer, ws As Worksheet, wt As Worksheet
MyPath = ActiveWorkbook.Path
MyName = ActiveWorkbook.Name: Set ws = Sheets("Summary")
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
Set objFolder = objFSO.GetFolder(MyPath)
Count = 0
Sheets("Summary").Select
For Each objFile In objFolder.Files
If objFile.Name <> MyName Then
Temp = objFile.Name
If objFile.Name Like "*.xls*" Then
MyLR = ws.Range("A65536").End(xlUp).Row + 1
ChDir MyPath
On Error GoTo ExitSub
Workbooks.Open Filename:=Temp: Set wt = ActiveSheet
wt.Range("A2", Cells(Range("A65536").End(xlUp).Row, 26)).Copy ws.Range("A" & MyLR)
Windows(objFile.Name).Close False
End If: End If
Next objFile
ExitSub: End Sub
The files for consolidation attached:Summary-Macros.zip
The expected resul would be: Expected-result.xls
Thanks in advance!
Bookmarks