View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
rglasunow[_16_] rglasunow[_16_] is offline
external usenet poster
 
Posts: 1
Default Code is dragging selection when should copy

The people on this forum have been most helpful by providing me wit
copying 1500 files into one with the code below. However, I have foun
one problem. Since it is copying a formula I'm not sure if that ha
anything to do with it. But after the 1st row it will copy the correc
file but the information is not correct. It's almost like you'v
dragged the selection down. Do you think a copy/paste special would b
the best route?

Sub MergeFiles()
Application.ScreenUpdating = False
Dim FName As String
Dim WB As Workbook
Dim Dest As Range
Const FOLDERNAME = "C:\Survey\Test"
ChDrive FOLDERNAME
ChDir FOLDERNAME

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

Do Until FName = ""
Set WB = Workbooks.Open(FName)
Windows(FName).Activate
Sheets("Data").Visible = True
WB.Worksheets("Data").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