Combining excel files

John44

New Member
Joined
Oct 1, 2014
Messages
45
Hi,

I get sent about 100 excel files of products sold and most have only a few lines of excel. What I would like to do is have one excel files with a hundred tabs. Is there a way I can quickly do this as cutting and pasting all these files into tabs is so time consuming.

Thanks

John
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
May be getting somewhere. Keep getting this message which i have to click through
1620917010090.png
 
Upvote 0
Could you replace the earlier code with this:

VBA Code:
Sub Identify_source_files()

Application.DisplayAlerts = False
 
    Sheets("List with source files").Select
    Columns("A:A").ClearContents
    Range("A1").Select

Dim oFSO As Object
Dim oFolder As Object
Dim oFile As Object
Dim i As Integer

' This is the location of the source files!
' Do not put the macro file in the same folder!
FolderLocation = "C:\Users\peter\OneDrive\Documents\MR Excel\OpenPO"

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(FolderLocation)

For Each oFile In oFolder.Files

' Identify the source file
    Cells(i + 1, 1) = oFile.Name
    i = i + 1
' Open the source file
    Dim wkb As Workbook
    Set wkb = Workbooks.Open(FolderLocation & "\" & Range("A" & i).Value)
' Copy the contents of the source file
    ActiveSheet.UsedRange.Copy
' Return to the master file
    Workbooks("Combine Files MK.xlsm").activate
' Add new worksheet
    Sheets.Add After:=ActiveSheet
' Paste data
    Range("A1").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
' Close source file
    Sheets("List with source files").Select
    Workbooks(Range("A" & i).Value).Close SaveChanges:=False


Next oFile

End Sub
 
Upvote 0
Ok. It starts working and then my excel stops working after about 10 seconds. Could it be related to all the other macros that appear that are related to an 'add ins' menu I use?
 
Upvote 0
Ok. It starts working and then my excel stops working after about 10 seconds. Could it be related to all the other macros that appear that are related to an 'add ins' menu I use?
I am sorry, can't help you with that. I am not that familiar with add-ins.
 
Upvote 0
I need to email someone the spreadsheet. Would they get all those macros? I guess they would only need one. Alt F8 shows loads of macros in all other places. I will try to reduce the number of files and then see if it works
 
Upvote 0
Thank you for your time with this. It can do about 15 files and then I get this message and then it crashes.

1620918882850.png
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,834
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top