Excel - merging numerous files
the best way is to put all the files in one directory and then run the macro
below. Modify the Folder location and the Sheet Names ("Sheet1").
Sub MergeBook()
Folder = "c:\temp\"
Set DestSheet = ActiveSheet
FName = Dir(Folder & "*.xls")
Do While FName < ""
LastRow = DestSheet.Range("A" & Rows.Count).End(xlUp).Row
NewRow = LastRow + 1
Set OldBook = Workbooks.Open(Filename:=Folder & FName)
With OldBook.Sheets("Sheet1")
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
.Rows("1:" & LastRow).Copy Destination:=DestSheet.Rows(NewRow)
End With
OldBook.Close savechanges:=False
FName = Dir()
Loop
End Sub
"drumbumuk" wrote:
I have about 40 xl files, that I want to merge - quickly! But i dont want to
import row one as this just contains field names.
Any suggestions?
|