View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Copy worksheets into new file

Try this example
http://www.rondebruin.nl/copy3.htm

This will give you some ideas
Post back if you need more help


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



"rglasunow " wrote in message ...
I am currently trying to write a macro to run a summary. I have
numerous Excel files under a folder and I would like to have specific
tabs copied into one workbook. Below is the code that I have tried and
is not working. Any sugestions would be great. Also would it be
possible to name the tabs off a specific cell in each worksheet?

Thanks in advance!!

Sub RyanTabCombo()

Application.ScreenUpdating = False
Dim FName As String
Dim WB As Workbook
Dim Dest As Range
Const FOLDERNAME = "C:\Excel Test\Summaries"
ChDrive FOLDERNAME
ChDir FOLDERNAME

Workbooks.Open Filename:= _
"C:\Excel Test\Ryan - Summary Template.xls"
Set Dest = Range("A1")
FName = Dir("*.xls")

Do Until FName = ""
Set WB = Workbooks.Open(FName)
WB.Worksheets("Sheet1").Move Destination:=Dest
WB.Close savechanges:=False
Set Dest = Windows("Ryan - Summary Template.xls")
FName = Dir()
Loop

MsgBox "The summary is completed. Thank you."

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\Excel Test\Ryan - " & Format(Date,
"mm-dd-yyyy") & ".xls"
ActiveWorkbook.Close

End Sub


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