Copy,paste macro from multiple sheets


Posted by Mar on September 27, 2001 11:55 AM

How would you go about making a macro that opens a list of workbooks and then copies the same range from all the workbooks and paste them in a new workbook?
thanx



Posted by Barrie Davidson on September 27, 2001 12:53 PM

Try this macro.

Sub Open_and_Copy()
' Written by Barrie Davidson
Dim receivingFile As String
Dim filestoOpen, openFile
filestoOpen = Application.GetOpenFilename(, , , , True)
Workbooks.Add
receivingFile = ActiveWorkbook.Name
For count = 1 To UBound(filestoOpen)
Workbooks.Open FileName:=filestoOpen(count)
openFile = ActiveWorkbook.Name
Range("Your_Data_Range_Name").Copy
Workbooks(receivingFile).Activate
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.End(xlDown).Offset(1, 0).Select
Workbooks(openFile).Close
Next count
End Sub


Regards,
BarrieBarrie Davidson