Thread: Merging Files
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
rglasunow[_13_] rglasunow[_13_] is offline
external usenet poster
 
Posts: 1
Default Merging Files

Someone helped me with the code to merge all the files under one folder
onto one spreadsheet. However, from the code below is there a way I
can tell Excel to open a file and copy from a specific worksheet?

Application.ScreenUpdating = False
Dim FName As String
Dim WB As Workbook
Dim Dest As Range
Const FOLDERNAME = "" ChDrive FOLDERNAME
ChDir FOLDERNAME

Set Dest = Range("A2")
FName = Dir("*.xls")

Do Until FName = ""
Set WB = Workbooks.Open(FName)
WB.Worksheets(1).Rows(2).Copy Destination:=Dest
WB.Close savechanges:=False
Set Dest = Dest(2, 1)
FName = Dir()
Loop
End Sub

Thank you!!


---
Message posted from http://www.ExcelForum.com/