PC Review


Reply
Thread Tools Rate Thread

Consolidate Files

 
 
yanf7
Guest
Posts: n/a
 
      24th Nov 2003

Hi.
I have a number of files that have the same structure and includ
couple spreadsheets. I need to make one new file that will copy all th
information from the same spreadsheet name "Ratio".
So at the end I will have a new file with number of spreadsheets tha
will have names of the files they were copied from.
Pls help

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

 
Reply With Quote
 
 
 
 
Bernie Deitrick
Guest
Posts: n/a
 
      25th Nov 2003
yanf,

Put all your files into one folder, then run the macro below after
changing the folder path in the code to match your actual path.

HTH,
Bernie
MS Excel MVP

Sub ConsolidateRatioSheet()
Dim myBook As Workbook
Dim myCalc As XlCalculation

With Application
.EnableEvents = False
.DisplayAlerts = False
myCalc = .Calculation
.Calculation = xlCalculationManual
End With
On Error Resume Next
With Application.FileSearch
.NewSearch
'Change this to your directory
.LookIn = "C:\Excel\Delete These\Ratio"
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Set myBook = Workbooks.Open(.FoundFiles(i))
Worksheets("Ratio").Select
Worksheets("Ratio").Name = _
Replace(ActiveWorkbook.Name, ".xls", "")
ActiveWindow.SelectedSheets.Move _
After:=ThisWorkbook.Sheets(1)
myBook.Close False
Next i
Else: MsgBox "There were no files found."
End If
End With
With Application
.EnableEvents = True
.DisplayAlerts = True
.Calculation = myCalc
End With

End Sub



"yanf7" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Hi.
> I have a number of files that have the same structure and include
> couple spreadsheets. I need to make one new file that will copy all

the
> information from the same spreadsheet name "Ratio".
> So at the end I will have a new file with number of spreadsheets

that
> will have names of the files they were copied from.
> Pls help.
>
>
> ------------------------------------------------
> ~~ Message posted from http://www.ExcelTip.com/
> ~~View and post usenet messages directly from

http://www.ExcelForum.com/
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to consolidate data from different files? Khoshravan Microsoft Excel Worksheet Functions 2 5th Apr 2010 10:10 PM
Consolidate Sent items from 4 different .pst files Tatia Microsoft Outlook Discussion 0 27th Apr 2008 09:20 PM
Several .pst files -- How can I consolidate them?? =?Utf-8?B?amVoeXR1?= Microsoft Outlook Installation 2 2nd Apr 2006 03:28 PM
Consolidate data from different files Gizmo Microsoft Excel Worksheet Functions 2 20th Jul 2004 08:11 PM
Consolidate files then have them magically go back to original files with my updates mamaro Microsoft Excel New Users 0 4th Feb 2004 06:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:35 AM.