Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Code is dragging selection when should copy

Look at this example
http://www.rondebruin.nl/copy3.htm

I add code in this subs that show you how to copy only the values


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"rglasunow " wrote in message ...
The people on this forum have been most helpful by providing me with
copying 1500 files into one with the code below. However, I have found
one problem. Since it is copying a formula I'm not sure if that has
anything to do with it. But after the 1st row it will copy the correct
file but the information is not correct. It's almost like you've
dragged the selection down. Do you think a copy/paste special would be
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/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
dragging formula to make selection memobile Excel Discussion (Misc queries) 2 July 30th 08 02:16 PM
Code for dragging the last column Gaurav[_2_] Excel Worksheet Functions 5 November 10th 07 12:13 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
Excel range selection as if dragging, keyboard not responding lohende New Users to Excel 1 July 22nd 07 03:26 PM
Copy and dragging cells Alex Jacinto Excel Worksheet Functions 1 November 10th 04 09:19 PM


All times are GMT +1. The time now is 06:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"