Code:
[COLOR=#3e3e3e][FONT=Courier New]Sub Consolidate_Trial()[/FONT][/COLOR]
[FONT=Courier New][COLOR=#3e3e3e]Dim wbkDst As Workbook[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]Dim wbkSrc As Workbook[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]Dim fso, f, fs, f1[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]Dim I As Long[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]Set fso = CreateObject("Scripting.FileSystemObject")[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]Set f = fso.getfolder("C:\Temp")[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]Set fs = f.Files[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]For Each f1 In fs[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]For I = 1 To fs.Count[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]If Right(f1.Name, 3) = "xls" Then[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]Set wbkSrc = Workbooks.Open("C:\Temp" & "\" & f1.Name)[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]Set wbkDst = ThisWorkbook[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]WsDst.Range("A" & I) = WsSrc.Range("E16")[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]WsDst.Range("B" & I) = WsSrc.Range("U17")[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]WsDst.Range("C" & I) = WsSrc.Range("D25")[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]WsDst.Range("D" & I) = f1.Name[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]End If[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]Next[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]Next[/COLOR][/FONT]
[FONT=Courier New][COLOR=#3e3e3e]End Sub<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>[/COLOR][/FONT]
[COLOR=#3e3e3e][FONT=Courier New]<o:p></o:p>[/FONT][/COLOR]
Using the above code i have been able to copy from all workbooks into a single workbook. What i am struggling with is to add header line data in the first line of my destination sheet. <o></o>
Eg. Name Destination Cost <o></o>
In my source workbook in column B there is a code called “FIN009” that is common across all workbooks. I need to search for it and if found then in my destination sheet i need to say complete if not found say incomplete using the above wstDst.Range(“E” &I) = “complete” or incomplete<o></o>
Can someone give me some pointers. I have cross posted this at OZGRID as well but have had not solutions. Appreciate your time and patience with this post.<o></o>