Combine Mutiple Worksheets into one

G

Guest

I have 60 differant excel files that are formatted the same way but need to
be combined into one master list. This is a databse of 60 of our sales
represtntives contact list. Each column is formatted identical between each
list. I want to combine all the lists into one for a mail campaign. Any
suiggestios to make this easy.
 
G

Guest

Ron,
Thanks for the help. I am still struggling. I am not a Visual Basic geek yet
but am learning. I took your script below to do this. I copied into my C
drive a file called Creating America which has all 60 work sheets. I am
confused on some of the language listed below. Sorry to sound stupid but I do
not understand the Dim basebook as Workbook. Maybe this is over my head but
hoping you can help. This is a mail list. from each representive and I want
to merge them so I can do one run on my mailing equipment. The only change I
did to your VB script was to change the directory for the files. I obviously
need to do more but am somewhat confused. Here is the error I am getting...

Script: C\Documents and Settings\Deanf.JBC\My Documents\Test.vbs
Line: 2
Char: 14
Error: Expected end of statement
Code: 800A0401
Source: Microsoft VBScript compilation error



Sub TestFile3()
Dim basebook As Workbook
Dim mybook As Workbook
Dim i As Long
Application.ScreenUpdating = False
With Application.FileSearch
.NewSearch
.LookIn = "C:\Creating America"
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() > 0 Then
Set basebook = ThisWorkbook
For i = 1 To .FoundFiles.Count
Set mybook = Workbooks.Open(.FoundFiles(i))
mybook.Worksheets(1).Copy after:= _
basebook.Sheets(basebook.Sheets.Count)
ActiveSheet.Name = mybook.Name
mybook.Close
Next i
End If
End With
Application.ScreenUpdating = True
End Sub
 
G

Guest

No. It is 60 seperate excel files. They are not in one file. I have 60
differant files. I could send you some examples if it helps.
 
R

Ron de Bruin

Hi Dean

Send me a few of the files and i look at it
Do you want to copy a worksheet ? or a range from each workbook
 
G

Guest

Also I am some what ignorant on visual basic so if you could give me a more
live example it would help. You guys are awesome with this kind of support
 
G

Guest

Ron,
How do I attach the files..



Ron de Bruin said:
Hi Dean

Send me a few of the files and i look at it
Do you want to copy a worksheet ? or a range from each workbook
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top